cmake :undefined reference to 'pthread_create',当CMake需要pthread库问题

在main.cpp同目录的CMakeLists.txt中添加两行:

find_package(Threads)

target_link_libraries(main ${CMAKE_THREAD_LIBS_INIT})

参考:http://stackoverflow.com/questions/1620918/cmake-and-libpthread

你可能感兴趣的:(linux开发环境)