启用-std = c ++ 0x或-std = gnu ++ 0x编译器选项

时间:2015-12-25 13:08:50

标签: c++ compilation

我尝试编译用C ++编写的特定源代码,但我没有得到可执行文件。相反,我从终端收到以下消息:

In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/array:35,
                 from cpptesting.cpp:6:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/c++0x_warning.h:31:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.

此消息的含义是什么,以及如何修复系统?我试过输入'include'目录,但是找不到'c ++'选项。有没有人有建议?

1 个答案:

答案 0 :(得分:1)

你如何编译它?如果你使用像gcc .\cpptesting.cpp这样的控制台命令,你应该只为它添加一个选项: gcc -std=gnu++0x .\cpptesting.cpp

如果要使用make编译更复杂的程序,请检查makefile。 顺便说一下,你使用的是非常古老的gcc版本,在最近的版本中,默认情况下会启用此标准(IIRC)。