Linux创建消息队列报错:
/usr/bin/ld: /tmp/ccqjlEF4.o: in function `main':
/home/l/hello.c:76: undefined reference to `mq_open'
collect2: error: ld returned 1 exit status
解决方法:需要包含头文件<mqueue.h>和<fcntl.h>,在编译时还需加编译选项-lrt
#include <mqueue.h>
#include <fcntl.h>
编译:gcc -g hello.c -o hello -lrt