0

I am using C++11 thread with my project, on runtime I am getting the followiung:

"Enable multithreading to use std::thread: Operation not permitted"

Reading other posts I have added -lpthread to link against the pthreads library, still I get the same error...

Compilation Snap

g++ -ggdb -ffunction-sections -O0 -lpthread -std=gnu++11   -DDEBUG  -c HID.cpp -o Debug/HID.o -MD -MF Debug/HID.dep

How can I avoid the runtime exception? any caviats for using "-std=gnu++11" rather than "-std=c++11" ?

Community
  • 1
  • 1
NadavRub
  • 2,520
  • 27
  • 63

2 Answers2

0

Trying using -pthread instead of -lpthread.


user3816764
  • 489
  • 5
  • 22
0

Add : -lpthread after the source file on the build command line.