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