【发布时间】:2013-01-18 10:27:33
【问题描述】:
我正在尝试使用g++ 和-std=c++11 或c++0x 标志进行编译。
但是,我得到了这个错误
cc1plus: error: unrecognized command line option "-std=c++11"
g++ --version
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
【问题讨论】:
-
它是
-std=c++0x与 g++ -
@stefan 不正确,两者都是可能的。您使用的是哪个 gnu 版本? C++11 仅在 >= 4.3 中受支持。
-
运行
g++ --version。然后在这里发布版本号。 -
那太老了。该版本不支持 C++11。安装更高版本(如 4.7)以获得 C++11 支持。
-
系统管理员可能安装了支持 C++11 的编译器,但没有将其设为默认编译器。您可以通过尝试在控制台窗口中自动完成命令
g++-来检查安装了哪些特定版本的 GCC。
标签: c++ c++11 compiler-errors g++ std