当前位置: 代码迷 >> 综合 >> CLion中使用线程库`pthread.h`报错
  详细解决方案

CLion中使用线程库`pthread.h`报错

热度:42   发布时间:2023-09-18 22:53:23.0
  • 问题:
    在CLion中使用pthread.h报错:
make[3]: *** [CMakeFiles/TinyWebServer.dir/build.make:84: xxx] Error 1
make[2]: *** [CMakeFiles/Makefile2:76: CMakeFiles/xxx.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/xxx.dir/rule] Error 2
make: *** [Makefile:118: TinyWebServer] Error 2
  • 解决方法
    CMakeLists.txt中加上下面这行:
set(CMAKE_CXX_FLAGS -pthread)
  相关解决方案