简体   繁体   English

Eclipse CDT中的POSIX IPC链接器错误

[英]POSIX IPC linker error in Eclipse CDT

I´m going to implement a IPC library, using the POSIX API. 我将使用POSIX API实现IPC库。 ( Ubuntu / Eclipse CDT ) Unfortunately I´m having Linker errors. (Ubuntu / Eclipse CDT)不幸的是我遇到了Linker错误。 The library should be available because Linux supports POSIX message queues since kernel 2.6.6. 该库应该可用,因为从内核2.6.6开始,Linux支持POSIX消息队列。

#include <mqueue.h>
#include <sys/stat.h>
...

msgq_id = mq_open("/queueName", O_RDWR | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG, NULL);

when it invokes the GCC C++ Linker it ends up in "undefined reference to `mq_open' " 当它调用GCC C ++链接器时,它以“对mq_open的未定义引用”结尾

I think it could be a general Linux configuration Problem. 我认为这可能是一般的Linux配置问题。

I have had some issues using Eclipse CDT as well. 我在使用Eclipse CDT时也遇到了一些问题。 I solved this by setting up a cmake project to be independent from the eclipse configurations. 我通过设置一个独立于eclipse配置的cmake项目解决了这个问题。

A good point to start is the tutorial section from cmake.org 一个很好的起点是cmake.org教程部分

I hope this helps you. 我希望这可以帮助你。

I've had the same problem and this worked for me: 我遇到了同样的问题,这对我有用:

In the Eclipse project properties/C/C++ General/ Paths and Symbols , under Libraries click on Add and type "rt" (no quotes). 在Eclipse项目properties / C / C ++ General / Paths and Symbols中,在Libraries下,单击Add并输入“ rt”(无引号)。 This should tell it to include -lrt when building which is required when using POSIX queues. 这应该告诉它在构建时包括-lrt,这是使用POSIX队列时所需的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM