apue make错误

来源:互联网 发布:深入.net平台和c 编程 编辑:程序博客网 时间:2024/06/03 14:21
gcc -DLINUX -ansi -I/home/alex/apue/apue.2e/include -Wall -D_GNU_SOURCE -DDEBUG  -c -o printd.o printd.c
In file included from /usr/include/bits/time.h:86:0,
                 from /usr/include/time.h:42,
                 from /usr/include/pthread.h:26,
                 from printd.c:11:
/usr/include/bits/timex.h:31:7: 错误:expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token
make[2]: *** [printd.o] 错误 1
make[2]: 离开目录“/home/alex/apue/apue.2e/ipp”
make[1]: *** [linux] 错误 1
make[1]: 离开目录“/home/alex/apue/apue.2e”

make: *** [all] 错误 2


出现这个问题的原因是在timex.h的第31行出现了status的定义:
  int status;                /* clock command/status */

而文件apue.2e/ipp/ipp.h中有宏定义:
#define status u.st

这样编译的时候就出问题了,如编译提示:
expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token

解决方法是把ipp.h文件里的status改成其他名称,比如Status,再次编译,错误提示status神马的信息,找到status出错的位置,把它改为Status就行了。
此处我的status出错位置在printd.c的第977行中:
                        i = ntohs(hp->status);






原创粉丝点击