#include <thread> erorr c ++ 11

时间:2017-01-18 02:49:50

标签: c++ multithreading c++11 gcc

我在#include <thread>

时遇到错误

错误是 -

In file included from /usr/include/c++/4.8/thread:35:0,
                 from main.cpp:35:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

但我正在编译c ++ 11,就像这样...

g++ main.cpp -o main -std=c++11

还通过选择了c ++ 11的NetBeans进行编译。

gcc版本4.8.5(SUSE Linux)

1 个答案:

答案 0 :(得分:-1)

g ++版本4.8.5相当陈旧,只有部分线程支持。见https://gcc.gnu.org/onlinedocs/gcc-4.8.5/libstdc++/manual/manual/status.html#status.iso.2011

尝试将您的gcc套件更新为发行版的最新版本,您应该很好。