CMake编译出现undefined reference to symbol ‘pthread_create@@GLIBC_2.2.5‘

解决办法:
在CMakeLists.txt文件中的target_link_libraries()后面添加-lpthread,形式如下:

target_link_libraries(${PROJECT_NAME}
${PCL_LIBRARIES}
${EIGEN3_LIBS}
${OpenCV_LIBS}
-lpthread
)

你可能感兴趣的:(C++学习笔记,c++)