undefined reference to symbol 'pthread_sigmask@@GLIBC_2.2.5' 解决方法

/usr/bin/ld: CMakeFiles/xxxx/yyyyy.cpp.o: undefined reference to symbol 'pthread_sigmask@@GLIBC_2.2.5'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

原因:

CMakeList.txt 错误

find_package(Threads REQUIRED)

之后少写了链接库位置

target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
 

 

 


 

你可能感兴趣的:(C/C++)