验证 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. NoActionBar主题下如何添加OptionsMenu

    菜单无法显示 为了不显示标题栏,所以主题使用了 NoActionBar,这也直接导致选项菜单无处显示 解决方案 添加一个ToolBar,自定义标题栏 <androidx.appcompat.wi ...

  2. Golang搭建接口测试框架

    测试报告 使用goconvey作为测试报告,使用方法: 安装 $ go get github.com/smartystreets/goconvey $ $GOPATH/bin/goconvey 导入包 ...

  3. JVM 第二篇:垃圾收集器以及算法

    本文内容过于硬核,建议有 Java 相关经验人士阅读. 0. 引言 一说到 JVM ,大多数人第一个想到的可能就是 GC ,今天我们就来聊一聊和 GC 关系最大的垃圾收集器以及垃圾收集算法,希望能通过 ...

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

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

  5. 基于Intel x86 Android的RAD游戏开发

    zip文件还包含编译的"MonkeyGame-debug".可以在模拟器中运行的二进制文件.在"game.build"文件夹中有一个HTML5 build.在C ...

  6. 线程基本使用--Thread内部方法调用start

    一个问题,下面的代码会如何运行 public class TraditionalThread { public static void main(String[] args) { System.out ...

  7. Oracle体系结构概述与SQL解析剖析

    Oracle服务器 是一个数据库管理系统,它提供了一种全面.开放.集成的方法来管理信息. Oracle服务器由Oracle数据库和Oracle实例组成. oracle数据库软件和Oracle数据库软件 ...

  8. win32获取进程树,以及命令行参数

    1.先上代码 package main import ( "bytes" "errors" "flag" "fmt" & ...

  9. pytest文档42-fixture参数化params

    前言 参数化是自动化测试里面必须掌握的一个知识点,用过 unittest 框架的小伙伴都知道使用 ddt 来实现测试用例的参数化. pytest 测试用例里面对应的参数可以用 parametrize ...

  10. 基于python实现顺序存储的队列代码

    """ 队列-顺序存储 seqqueue.py 代码实现 """ # 自定义异常类 class QueueError(Exception): ...