Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ubuntu上是否有将cmake与mqueue.h一起使用的方法_Cmake_Ipc - Fatal编程技术网

在ubuntu上是否有将cmake与mqueue.h一起使用的方法

在ubuntu上是否有将cmake与mqueue.h一起使用的方法,cmake,ipc,Cmake,Ipc,CMakeFiles/mqcreate.dir/mqcreate1.cc.o:在函数main'中: mqcreate1.cc:.text+0xa0:未定义的引用tomq_open' mqcreate1.cc:.text+0xad:mq\u close'的未定义引用 find_library(LIBRT rt) if(LIBRT) target_link_libraries(target_name ${LIBRT}) endif() 您需要链接到正确的库才能使用这

CMakeFiles/mqcreate.dir/mqcreate1.cc.o:在函数main'中: mqcreate1.cc:.text+0xa0:未定义的引用tomq_open' mqcreate1.cc:.text+0xad:mq\u close'的未定义引用

   find_library(LIBRT rt) 
   if(LIBRT)
      target_link_libraries(target_name ${LIBRT})
   endif()

您需要链接到正确的库才能使用这些函数。请参阅Ubuntu上的man mq_open。它应该告诉你该使用哪一个。但我仍然不明白add\u compile\u options-lrt不是work@Ericlee因为它不是编译选项,而是链接期间使用的库。find_library可能有些过分,target_link_librariestarget_name rt应该足够了,因为它是一个标准的操作系统库,链接器可以自己找到。