unix network programming volume 2 interprocess communications second edition环境搭建出错的处理

 1 1. 编译原书所带例子:
 2   unpv22e.tar.gz 下载地址:http://www.kohala.com/start/unpv22e/unpv22e.tar.gz
 3   2. 解压:
 4   $tar -zxvf unpv22e.tar.gz
 5   3. 编译:
 6   $cd unpv22e
 7   $ ./configure
 8   $ cd lib
 9   $ make
10   gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -o daemon_inetd.o daemon_inetd.c
11   In file included from /usr/include/netinet/in.h:23,
12   from /usr/include/rpc/types.h:90,
13   from /usr/include/rpc/rpc.h:41,
14   from unpipc.h:115,
15   from daemon_inetd.c:1:
16   /usr/include/stdint.h:49: 错误:重复的 'unsigned'
17   /usr/include/stdint.h:49: 错误:声明指定了两个以上的数据类型
18   /usr/include/stdint.h:50: 错误:重复的 'unsigned'
19   /usr/include/stdint.h:50: 错误:重复的 'short'
20   /usr/include/stdint.h:52: 错误:重复的 'unsigned'
21   /usr/include/stdint.h:52: 错误:声明指定了两个以上的数据类型
22   make: *** [daemon_inetd.o] 错误 1
23   这时需要修改unpipc.h第115行。unpipc.h中把115内容注释掉。再次编译。
24   $ make
25   gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -o daemon_inetd.o daemon_inetd.c
26   In file included from daemon_inetd.c:1:
27   unpipc.h:479: 错误:expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
28   unpipc.h:480: 错误:expected ')' before '*' token
29   make: *** [daemon_inetd.o] 错误 1
30   再次出现错误,把unpipc.h中第479,480行注释掉。再次编译。
31   $ make
32   ...
33   gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -o wrapsunrpc.o wrapsunrpc.c
34   wrapsunrpc.c:3: 错误:expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
35   wrapsunrpc.c:16: 错误:expected ')' before '*' token
36   make: *** [wrapsunrpc.o] 错误 1
37   这时还会出现上面的错误,这时需要修改unpv22e/Make.defines中的LIB_OBJS的".o"文件,删除"wrapsunrpc.o"38   再次编译。
39   $ make
40   --这次应该没有问题了。

         参考地址            http://blog.chinaunix.net/uid-27164517-id-3320677.html

 

下载的源码有些头文件没有,不过在lib里面按照上面修改之后基本能跑起来例子程序。

posted @ 2015-09-07 16:12  kongchung  阅读(320)  评论(0编辑  收藏  举报