学习posix mq时,写了个简单程序,编译通过,链接时加了-lrt仍报错:
undefined reference to `mq_open'
undefined reference to `mq_close'
请问大神们这到底是什么原因。
ubuntu12.04 posix mq 链接-lrt仍失败undefined reference to mq_open
-
- 帖子: 3
- 注册时间: 2013-03-25 13:41
- 系统: ubuntu 12.04
-
- 帖子: 32
- 注册时间: 2013-03-18 15:32
- 系统: xp
-
- 帖子: 3
- 注册时间: 2013-03-25 13:41
- 系统: ubuntu 12.04
Re: ubuntu12.04 posix mq 链接-lrt仍失败undefined reference to mq_
网上找了很久,没有找到答案,才来这边求教的。风雨同路 写了:哥们,要学会灵活用搜索功能,当你真的找不到的时候才来问人吧
-
- 帖子: 3
- 注册时间: 2013-03-25 13:41
- 系统: ubuntu 12.04
Re: ubuntu12.04 posix mq 链接-lrt仍失败undefined reference to mq_
问题解决了,在ubuntu 12.04存在这样的问题
gcc -g -lrt -o test_mq test_mq.c
会报undefined reference
如果使用下面的编译命令则不会
gcc -g -o test_mq test_mq.c -lrt
囧
gcc -g -lrt -o test_mq test_mq.c
会报undefined reference
如果使用下面的编译命令则不会
gcc -g -o test_mq test_mq.c -lrt
囧