gcc 4.7给我错误信息

时间:2012-04-11 14:45:17

标签: c++ gcc

我有Debian 6.04,包含的最新gcc版本是gcc 4.4,这个版本不支持C ++ 11,我寻找另一个版本支持C ++ 11(一些功能不完全支持),所以我遵循这个Page

我建议安装它,My NetBeans IDE成功找到gcc 4.7并链接它,但是当我使用std :: unique_ptr使用测试编译代码时,我收到此错误消息:

此文件需要编译器和库支持\ ISO C ++ 2011标准。这种支持目前是实验性的,必须是\ 使用-std = c ++ 11或-std = gnu ++ 11编译器选项启用。

我发现了错误来源,她是:

位/ C ++ 0x_warning.h

#ifndef _CXX0X_WARNING_H
#define _CXX0X_WARNING_H 1

#ifndef __GXX_EXPERIMENTAL_CXX0X__
#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.
#endif

#endif

1 个答案:

答案 0 :(得分:2)

错误说明了一切。尝试将-std=c++11-std=gnu++11添加到NetBeans IDE中的编译器选项。

我没有使用Netbeans,但是看到这个link,其中显示了构建变量的快照,这是您需要添加编译器选项的地方。