what(): Enable multithreading to use std::thread: Operation not permitted

Using C++11 thread in linux causes the following problems:

Starting: /home/hansry/Code/Algorithm_design/chess/bin/chess
terminate called after throwing an instance of 'std::system_error'
  what():  Enable multithreading to use std::thread: Operation not permitted
Spawning 3 threads...
*** Crashed with return code: 0 ***

Just add the following command to CMakeLists:

set(CMAKE_CXX_FLAGS "-std=c++11 -pthread ")

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325729161&siteId=291194637