#include <thread> erorr c++11

#include <thread> erorr c++11

本文关键字:erorr c++11 gt thread #include lt      更新时间:2023-10-16

我收到#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)

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

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