Unix网络编程(卷二)源码编译报错解决
来源:互联网 发布:public static json 编辑:程序博客网 时间:2024/05/22 08:21
Unix网络编程(卷二)源码编译报错解决
源码下载地点:http://www.kohala.com/start/unpv22e/unpv22e.html
1、按照Readme操作,进入lib目录下make报错:
gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -o daemon_inetd.o daemon_inetd.c
In file included from /usr/include/netinet/in.h:24,
from /usr/include/rpc/types.h:90,
from /usr/include/rpc/rpc.h:38,
from unpipc.h:115,
from daemon_inetd.c:1:
/usr/include/stdint.h:49: error: duplicate ‘unsigned’
/usr/include/stdint.h:49: error: two or more data types in declaration specifiers
/usr/include/stdint.h:50: error: duplicate ‘unsigned’
/usr/include/stdint.h:50: error: duplicate ‘short’
/usr/include/stdint.h:52: error: duplicate ‘unsigned’
/usr/include/stdint.h:52: error: two or more data types in declaration specifiers
make: *** [daemon_inetd.o] 错误 1
修改config.h 注释掉一下三行:
//#define uint8_t unsigned char /* <sys/types.h> */
//#define uint16_t unsigned short /* <sys/types.h> */
//#define uint32_t unsigned int /* <sys/types.h> */
2、链接报错:将生成的libunpipc.a链接到我们的c程序时报错。
./libunpipc.a(wrapunix.o): In function `Mktemp':
/home/vonnyfly/Document/unix_src/unpv22e/lib/wrapunix.c:184: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/tmp/ccKNDn2N.o: In function `main':
mqcreate1.c:(.text+0x3a): undefined reference to `GetOpt'
./libunpipc.a(wrapunix.o): In function `Shm_unlink':
wrapunix.c:(.text+0x54d): undefined reference to `shm_unlink'
./libunpipc.a(wrapunix.o): In function `Shm_open':
wrapunix.c:(.text+0x58c): undefined reference to `shm_open'
./libunpipc.a(wrapunix.o): In function `Sem_getvalue':
wrapunix.c:(.text+0x6d4): undefined reference to `sem_getvalue'
./libunpipc.a(wrapunix.o): In function `Sem_post':
wrapunix.c:(.text+0x6fd): undefined reference to `sem_post'
./libunpipc.a(wrapunix.o): In function `Sem_trywait':
wrapunix.c:(.text+0x72e): undefined reference to `sem_trywait'
./libunpipc.a(wrapunix.o): In function `Sem_wait':
wrapunix.c:(.text+0x77d): undefined reference to `sem_wait'
./libunpipc.a(wrapunix.o): In function `Sem_destroy':
wrapunix.c:(.text+0x7ad): undefined reference to `sem_destroy'
./libunpipc.a(wrapunix.o): In function `Sem_init':
wrapunix.c:(.text+0x7eb): undefined reference to `sem_init'
./libunpipc.a(wrapunix.o): In function `Sem_unlink':
wrapunix.c:(.text+0x81d): undefined reference to `sem_unlink'
./libunpipc.a(wrapunix.o): In function `Sem_close':
wrapunix.c:(.text+0x84d): undefined reference to `sem_close'
./libunpipc.a(wrapunix.o): In function `Sem_open':
wrapunix.c:(.text+0x897): undefined reference to `sem_open'
wrapunix.c:(.text+0x8b0): undefined reference to `sem_open'
./libunpipc.a(wrapunix.o): In function `Mq_setattr':
wrapunix.c:(.text+0xbeb): undefined reference to `mq_setattr'
./libunpipc.a(wrapunix.o): In function `Mq_getattr':
wrapunix.c:(.text+0xc24): undefined reference to `mq_getattr'
./libunpipc.a(wrapunix.o): In function `Mq_notify':
wrapunix.c:(.text+0xc54): undefined reference to `mq_notify'
./libunpipc.a(wrapunix.o): In function `Mq_receive':
wrapunix.c:(.text+0xc92): undefined reference to `mq_receive'
./libunpipc.a(wrapunix.o): In function `Mq_send':
wrapunix.c:(.text+0xce2): undefined reference to `mq_send'
./libunpipc.a(wrapunix.o): In function `Mq_unlink':
wrapunix.c:(.text+0xd0d): undefined reference to `mq_unlink'
./libunpipc.a(wrapunix.o): In function `Mq_close':
wrapunix.c:(.text+0xd3d): undefined reference to `mq_close'
./libunpipc.a(wrapunix.o): In function `Mq_open':
wrapunix.c:(.text+0xd79): undefined reference to `__mq_open_2'
wrapunix.c:(.text+0xd9e): undefined reference to `mq_open'
collect2: ld returned 1 exit status
解决办法:gcc 添加-lrt命令选项(具体查看man mq_open)
3、找不到GetOpt:
/tmp/ccv1UEy3.o: In function `main':
mqcreate1.c:(.text+0x3a): undefined reference to `GetOpt'
collect2: ld returned 1 exit status
直接把程序改了getopt,没关系。
- Unix网络编程(卷二)源码编译报错解决
- Unix网络编程(卷二)unpv 源码下载及编译报错解决
- Unix网络编程(卷二)源码编译报错解决 .
- Unix网络编程(卷二)源码编译报错解决
- Unix网络编程(卷二)源码编译报错解决
- Unix网络编程(卷2)源码编译报错解决
- UNP Unix网络编程卷2源码编译问题
- unix网络编程卷1:套接字联网 源码编译
- UNIX网络编程卷2源码编译错误
- 《网络编程》关于 UNIX网络编程 卷1 的 unp.h 和源码编译问题
- 《网络编程》关于 UNIX网络编程 卷1 的 unp.h 和源码编译问题
- 《网络编程》关于 UNIX网络编程 卷1 的 unp.h 和源码编译问题
- unix网络编程(卷一)--安装源码
- 《UNIX网络编程 卷2》读书笔记(二)
- UNIX网络编程 卷二 IPC
- 《unix网络编程》源码编译
- 关于编译unix网络编程第二卷--进程间通信源代码的问题及解决
- ubuntu16.04 UNIX 网络编程卷一 源码使用
- 基础练习 2n皇后问题
- 经历的一些面试题
- png 批量 转 pvr.ccz
- 消息队列莫名其妙的错误 mq_open失败,Invalid argument
- linux基本操作命令
- Unix网络编程(卷二)源码编译报错解决
- 黑马程序员 ARC基本使用
- monkey
- POJ 2375 Cow Ski Area (强连通分量)
- Linux /etc/issue 和 /etc/issue.net的作用和区别
- 蛇形填数
- ios 长链接与短链接之间的转换
- c++新技能不断get中
- Maven理解与使用