C++ 不能包括“不可抗力”;“随机”;c+中的头文件+;
我有gcc版本4.8.4,但当我添加头文件C++ 不能包括“不可抗力”;“随机”;c+中的头文件+;,c++,c++11,header-files,C++,C++11,Header Files,我有gcc版本4.8.4,但当我添加头文件#include时,它会给我错误: /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 -
#include
时,它会给我错误:
/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.
#error This file requires compiler and library support for the \
错误消息显示:
此文件需要编译器和库支持ISO C++ 2011 标准此支持目前处于试验阶段,必须启用 使用
-std=c++11
或-std=gnu++11
编译器选项
因此,您需要确保将-std=c++11
(对于标准c++)或-std=gnu++11
(对于标准c++的gnu扩展)传递给编译命令。例如:
g++-std=c++11-Wall myfile.cc-o myfile
如果可以的话,我建议您也使用较新版本的GCC,以便正确支持C++11而不是“实验性的”。因此,您在编译器选项中添加了
-std=C++11
或-std=gnu++11
,对吗?然后就不再抱怨了?如果没有,您需要更具体地说明如何编译。(事实上,对于这样一个旧的GCC,它可能只接受-std=c++0x
,而不是-std=c++11
)。@TobySpeight如果答案是问题的一部分,你难道不喜欢它吗?不,我没有添加它。@TobySpeight我如何编辑它?你能帮我一下吗?我是C++新手,错误信息对我来说非常清楚。它说明了它不工作的原因:编译器不支持它。并描述如何启用编译器支持。