我在我的项目中使用C ++ 11线程,在运行时我得到了以下内容:
"Enable multithreading to use std::thread: Operation not permitted"
阅读other posts我添加了-lpthread来链接pthreads库,但我仍然得到同样的错误......
编辑Snap
g++ -ggdb -ffunction-sections -O0 -lpthread -std=gnu++11 -DDEBUG -c HID.cpp -o Debug/HID.o -MD -MF Debug/HID.dep
如何避免运行时异常?任何使用的鱼缸" -std = gnu ++ 11"而不是" -std = c ++ 11" ?
答案 0 :(得分:0)
尝试使用-pthread而不是-lpthread。
答案 1 :(得分:0)
添加:-lpthread 在构建命令行上的源文件之后。