cmake需要链接pthread库时,如果写法不当,会出现如下错误:
undefined reference to `pthread_create'
正确的解决办法是:
cmake_minimum_required (VERSION 2.6) find_package (Threads) add_executable (myapp main.cpp ...) target_link_libraries (myapp ${CMAKE_THREAD_LIBS_INIT})
参考:http://stackoverflow.com/questions/1620918/cmake-and-libpthread
文章的脚注信息由WordPress的wp-posturl插件自动生成