Unix高级环境编程 学习

来源:互联网 发布:pascal语言编程设计 编辑:程序博客网 时间:2024/05/21 17:47

编写第一个例子会出现

other_name.c: In function ‘opendir_file’:

other_name.c:21:2: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
/tmp/cc2qJGMx.o: In function `opendir_file':
other_name.c:(.text+0x14): undefined reference to `err_quit'
other_name.c:(.text+0x3b): undefined reference to `err_sys'

collect2: ld returned 1 exit status

这是因为需要下载随书附带的源代码并编译所需的库文件,步骤在这里可以参照博客 http://blog.csdn.net/davidyuxuan/article/details/8820927

在这里编译make源码的时候会可能出现错误:

/usr/include/i386-linux-gnu/bits/timex.h:31:7: 错误: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token
make[2]: *** [printd.o] 错误 1
make[2]:正在离开目录 `/tmp/apue.2e/ipp'
make[1]: *** [linux] 错误 1
make[1]:正在离开目录 `/tmp/apue.2e'
make: *** [all] 错误 2

这里可以参照 http://blog.163.com/fishing_1/blog/static/41594482013335953444/ 就可以顺利解决