命令前面加上以下两句代码即可: set(CMAKE_CXX_FLAGS -pthread) message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
在ubuntu16.04下采用CMake编译c++代码,在CMakeLists.txt里的add_definitions()已添加-lpthread(即add_definitions("-g -std=c++11 -lpthread")),CMakeLists.txt文件内容如下: cmake_minimum_required(VERSION 3.5) project(xjc_cpp11) set(CMAKE_CXX_STANDARD 14) add_definitions("-g -std=c++11 -lpthread"...