我正在我的项目中使用 C++11 线程,在运行时我得到以下信息:
"Enable multithreading to use std::thread: Operation not permitted"
阅读其他帖子,我添加了 -lpthread 以链接到 pthreads 库,但我仍然收到同样的错误......
编译快照
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"的任何鱼子酱?
尝试使用 -pthread 而不是 -lpthread。
add : -lpthread在构建命令行上的源文件之后。