标签:linux c++11 c++0x stdsystem_error 多线程
在看《Cplusplus Concurrency In Action Practical Multithreading》时遇到第一个例子:
#include<iostream> #include<thread> void hello() { std::cout<<"hello concurrent world\n"; } int main() { std::thread t(hello); t.join(); }
terminate called after throwing an instance of ‘std::system_error‘
what(): Enable multithreading to use std::thread: Operation not permittedAborted (core dumped)
在查了好久才发现问题,是编译器的问题,编译时要加上选项
-Wl,--no-as-needed
参考这里:http://stackoverflow.com/questions/19463602/compiling-multithread-code-with-g
在
标签:linux c++11 c++0x stdsystem_error 多线程
原文地址:http://blog.csdn.net/kangroger/article/details/39901601