qt c++11 thread 执行错误

来源:互联网 发布:淘宝网颜色分类 编辑:程序博客网 时间:2024/05/23 23:48

qt使用C++11 thread

pro文件如下:

QMAKE_CXXFLAGS += -std=c++11
LIBS += -lpthread


出现如下错误:

terminate called after throwing an instance of 'std::system_error'
  what():  Enable multithreading to use std::thread: Operation not permitted
Aborted (core dumped)


后查找到这篇文章:

https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201


解决如下:

修改pro文件:


QMAKE_CXXFLAGS += -std=c++11

QMAKE_LFLAGS += -Wl,--no-as-needed

LIBS += -lpthread

0 0
原创粉丝点击