ubuntu下ros c++添加第三方依赖库(一开始报错undefined reference to symbol 'pthread

xiaoxiao2021-02-28  101

使用第三方库的话,直接修改package 对应的CMakeLists.txt 文件,使用标准的CMake宏 添加头文件搜索路径: INCLUDE_DIRECTORIES(/usr/include/)添加库文件搜索路径: LINK_DIRECTORIES(/usr/lib/) 添加对库的链接: TARGET_LINK_LIBRARIES(target lib)

我的错误是因为没有添加pthread这个多线程库 

所以要在target_link_libraries(hello ${catkin_LIBRARIES} librslidar_sdk.a pthread)添加这个库 因为pthread并非Linux系统的默认库

转载请注明原文地址: https://www.6miu.com/read-32948.html

最新回复(0)