undefined reference to ‘pthread_create’ 问题解决
最近在学习用多线程,遇到undefined reference to ‘pthread_create’ 问题,对于该问题的解决办法,没太看懂g++ pthread.c -lpthread -o pthread
,这样的操作。
我用的ubuntu 18.04
最后通过在CmakeLists 中增加
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
问题得到解决。