clion运行下对‘pthread

    xiaoxiao2021-04-16  35

    由于pthread库不是Linux系统默认的库

    在CMakeLists.txt的最后加上:

    find_package(Threads REQUIRED) target_link_libraries(项目名称 Threads::Threads)

    其中,target_link_libraries的第一个参数 项目名称 为 add_executable(项目名称 ${SOURCE_FILES}) 语句中的项目名

    运行就可以编译通过了

    转载请注明原文地址: https://ju.6miu.com/read-672222.html

    最新回复(0)