4
用G ++编译多线程代码
我有史以来最简单的代码: #include <iostream> #include <thread> void worker() { std::cout << "another thread"; } int main() { std::thread t(worker); std::cout << "main thread" << std::endl; t.join(); return 0; } 尽管我仍然无法编译g++运行它。 更多细节: $ g++ --version g++ (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the …