验证 UNPv2里的一个例子时,连接时出现 undefined reference to 'mq_open' 错误。

man mq_open ,发现里面有这么一句话 :link with -lrt 。加上 -lrt 后,连接成功。

运行,出现 Permission deny。继续查,man mq_overview 发现: Each message queue is identified by a name of the form /somename. 也就是说在指定 mqueue 的名字时,必须以 ”/" 开头,并且名字中只能有一个 “/"。UNPv2的 2.2 IPC names有详细的解释。

终于运行成功了,却发现找不到创建的 mqueue , 继续 man mq_overview。发现下面一段:

Mounting the message queue file system
       On Linux, message queues are created in a virtual file system. (Other implementations may also provide such a feature, but the details are likely to differ.) This file system can be mounted using the following commands:

           $ mkdir /dev/mqueue
           $ mount -t mqueue none /dev/mqueue


       The sticky bit is automatically enabled on the mount directory.

       After the file system has been mounted, the message queues on the system can be viewed and manipulated using the commands usually used for files (e.g., ls(1) and rm(1)).

       The contents of each file in the directory consist of a single line containing information about the queue:

           $ ls /dev/mqueue/mymq
           QSIZE:129     NOTIFY:2    SIGNO:0    NOTIFY_PID:8260
           $ mount -t mqueue none /dev/mqueue

       These fields are as follows:

       QSIZE Number of bytes of data in all messages in the queue.

       NOTIFY_PID
              If this is non-zero, then the process with this PID has used mq_notify(3) to register for asynchronous message notification, and the remaining fields describe how notification occurs.

       NOTIFY Notification method: 0 is SIGEV_SIGNAL; 1 is SIGEV_NONE; and 2 is SIGEV_THREAD.

       SIGNO Signal number to be used for SIGEV_SIGNAL.

undefined reference to 'mq_open'的更多相关文章

  1. (转) Qt 出现“undefined reference to `vtable for”原因总结

    由于Qt本身实现的机制所限,我们在使用Qt制作某些软件程序的时候,会遇到各种各样这样那样的问题,而且很多是很难,或者根本找不到原因的,即使解决了问题,如果有人问你为什么,你只能回答--不知道. 今天我 ...

  2. undefined reference to `__android_log_print'

    使用android studio 编写NDK代码时出现错误:undefined reference to `__android_log_print' 解决办法: eclipse       andro ...

  3. CentOS 6.5 编译 PHP-7 报错:undefined reference to `libiconv_open 无法编译 PHP libiconv

    ./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zli ...

  4. Qt - 错误总结 - 在自定义类头文件中添加Q_OBJECT 编译时报错(undefined reference to ‘vtable for xxThread)

    错误提示:在添加的QThread子类头文件添加Q_OBJECT时,编译程序,出现"undefined reference to 'vtable for xxThread'"错误提示 ...

  5. Qt经典出错信息之undefined reference to `vtable for classname

    原文链接:Qt经典出错信息之undefined reference to `vtable for classname 这个出错信息太常见了,用过Qt两个月以上的朋友基本上都能自己解决了,因为太经典了, ...

  6. 解决undefined reference to `__poll_chk@GLIBC_2.16' 错误

    出现这个错误,是系统的glibc版本太低了,需要更新 到http://ftp.gnu.org/gnu/glibc/下载新版本的glibc,也不用太高,我选择glibc-2.20.tar.gz   解压 ...

  7. ubuntu系统下,gsl 库链接问题 -undefined reference to `cblas_xxx`

    今天在ubuntu系统下进行程序调试的时候出现以下错误信息: [ %] Linking CXX executable ../test_coco /usr/local/lib/libgsl.so: un ...

  8. Android APP使用NDK编译后的ffmpeg库出现undefined reference to 'posix_memalign'错误

    在android程序中使用NDK编译后的ffmpeg库的时候出现了如下错误: jni/libs/libavutil.a(mem.o): in function av_malloc:libavutil/ ...

  9. undefined reference to `Spreadsheet::staticMetaObject'

    <C++ GUI Qt 4 编程>学习 一.遇到的问题 在学完第4章后,Spreasheet程序也已经写好了.在用 FindDialog 搜索时发现没有效果. 二.解决过程 调试跟踪代码, ...

随机推荐

  1. Python-进程-进程池-原理

    进程 资源集合,调度和分配资源,说到进程就不得不提到线程,线程和进程是密不可分,进程申请了资源,但真正使用资源的是线程,其实本质上类似面向对象的思想,面向对象把数据和数据的操作封装在一个类中,进程把资 ...

  2. Matlab 中 imshow 函数

    转自: https://blog.csdn.net/xiaochou87/article/details/43488829 matlab中显示图像的语句是:                       ...

  3. opencv中namedWindow( )函数

    转自:https://blog.csdn.net/fanjiule/article/details/81606596 第一步,功能说明:namedWindow()的功能就是新建一个显示窗口.可以指定窗 ...

  4. Java 将Html转为PDF(二)

    前面介绍了如何通过插件的方式将Html文件转为PDF,该方法需要使用Spire.PDF for Java 3.6.6或者之后的新版本,可根据自己的系统选择不同插件来实现转换.本文提供另外一种转换方法, ...

  5. 达梦产品技术支持培训-day6-DM性能诊断与优化

    (本文只作为个人随笔用途,非官方文档,请勿作他用,谢谢) 1.DM8查询优化基本思路 1.1 操作系统性能诊断 linux常用系统监控命令 使用 top 命令查看cpu使用率 使用 iostat 命令 ...

  6. centos 6.4 配置本地yum源(iso镜像)

    1.先挂载 iso镜像  eg: mount -o loop /home/帐号/downloads/CentOS.iso /mnt/iso 2.用管理员帐号备份CentOS-Base.repo   e ...

  7. TMS, XYZ & WMTS的不同

    WMS是OGC定义的协议,用于请求任意区域的渲染地图图像.客户可以根据需要以平铺模式对其进行请求. WMS-C是OSGeo创建的WMS扩展,它向功能文档中添加了元数据,以使客户端知道在哪里发出请求,从 ...

  8. MeteoInfo家族的新产品:MeteoInfoLab

    为了更方便地处理各种数据并绘图,尝试开发了一个新的软件产品MeteoInfoLab,软件设计上参考了MatLab和Spider.软件以脚本程序和命令行交互为主,基于MeteoInfo库并利用Jytho ...

  9. 工业级wifi模块

    工业级wifi模块 工业级wifi模块ZLSN7004是上海卓岚开发的一款高性能的Wifi.以太网转串口模块.与普通的wifi模块定位在低成本不同,7004定位在高稳定性.丰富功能,设计目标是面向对功 ...

  10. swoft运行流程

    启动命令 php bin/swoft http:start 或者  swoftctl run -c http:start 1 入口文件 bin/swoft.php #!/usr/bin/env php ...