代码大体如下: int main(...) { ... mqd = mq_open(MSGQOBJ, O_RDWR | O_CREAT, FILE_MODE, NULL); if(mqd == -1) { perror("mq_open"); exit(1); } ... mq_close(mqd); mq_unlink(MSGQOBJ); exit(0); } 问题在: mq_open(MSGQOBJ, O_RDWR | O_CREAT, FILE_MODE, NULL); 编译后,能通过,也能正常执行。 但是如果把第四个参数由NULL改为attr,重新编译的时候就会...
by akei48 - C/C++ - 2009-09-04 15:40:09 阅读(9745) 回复(9)
我利用mq_open创建队列 程序提示未定义 在makefile中加入 -lposix4 结果提示无法找到 -lposixe4 请问linux下使用mq_open需要如何设置 谢谢
函数中使用mq_open函数产生一个posix消息队列,运行后出现mq_open: Permission denied, su到root模式下运行还是这样,请问会是什么样的问题会导致这种情况? 我的环境是fedora7 谢谢指点!
测试IPC时,提示如下信息: 先是找不到mqueue.h 后来copy了一个过来,结果提示mqd_t 未定义,后来定义为int类型, 提示如下信息: mq_open is not implemented and will always fail 请教各位大侠,怎样处理啊!!!!!!
源码如下:
#include
/tmp/cc0jERlh.o(.text+0x67): In function `eph_createmq': : undefined reference to `mq_open' /tmp/cc0jERlh.o(.text+0x9c): In function `eph_createmq': : undefined reference to `mq_unlink' collect2: ld returned 1 exit status
一个动态库,使用mq_open打开消息队列,然后使用mq_send发送信息,再mq_close关闭,一个进程调用这个动态库,在家里环境运行正常,但在现场出现问题:每调用一次虚拟内存多占用20M,调用不到200次,该进程占用虚拟内存4G,无法运行了,哪位老大能分析一下原因吗?有没有什么补丁能解决这个问题?
[code]
#include
在学习消息队列时编译提示:undefined reference to ‘mq_open’,联想线程的情况是不是缺少什么连接库?搜索论坛,-lrt和-lpthread都不行,请问应该是什么? 编译命令如下:cc mq_creat.c -lrt 有什么错误吗? 操作系统是freebsd5.2 [ 本帖最后由 user2003 于 2006-3-27 23:03 编辑 ]
如下这段代码如果用g++当成C++编译就可以编译过去,命令如下: g++ -lrt main.cpp 但是如果用gcc当成C语言编译就编译不过去,命令如下: gcc -lrt main.c 提示的错误如下: main.c: In function ‘main’: main.c:17: error: ‘S_IREAD’ undeclared (first use in this function) main.c:17: error: (Each undeclared identifier is reported only once main.c:17: error: for each function it appears in.) ...