Netbeans 7.2 中无法识别的命令行选项“-std=c++11”c++
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12377358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unrecognized command line option "-std=c++11" c++ in Netbeans 7.2
提问by Darren Hoehna
I am trying to use C++11. After sifting through the internet I found that all I have to do is
right click on my project -> properties and under the "C++ standard" select c++ 11. When I run the program with C++ 11, I get this error "unrecognized command line option -std=c++11
. One solution people have said is to add -g -std=c++0x
in the "Additional Options" but then I get "unrecognized command line option -std=c++0x
. I have downloaded gcc-4.7.1.tar.gz but I have no idea what to do with it.
我正在尝试使用 C++11。通过互联网筛选后,我发现我所要做的就是右键单击我的项目-> 属性,然后在“C++ 标准”下选择 c++ 11。当我使用 C++ 11 运行程序时,出现此错误“无法识别的命令行选项-std=c++11
。人们说的一种解决方案是添加-g -std=c++0x
“其他选项”,但随后我得到“无法识别的命令行选项” -std=c++0x
。我已经下载了 gcc-4.7.1.tar.gz 但我不知道如何处理它。
Does anyone know how to get rid of this error or know how to make net beans compile with c++11?
有谁知道如何摆脱这个错误或知道如何使用 c++11 编译 net bean?
回答by u861799
bump your gcc version to 4.7+. c++0x is supported since gcc4.3 while c++11 is supported since gcc4.7
将您的 gcc 版本提高到 4.7+。从 gcc4.3 开始支持 c++0x 而从 gcc4.7 开始支持 c++11
回答by Sanjay
Steps to configure through Netbeans IDE:
通过 Netbeans IDE 进行配置的步骤:
- Right click on project and goto properties
- Go to Build -> C++Compiler
- In right hand side panel there are few options go to Basic options -> C++ Standard change its value from C++ 11 to C++ 98
- 右键单击项目并转到属性
- 转到构建 - > C++编译器
- 在右侧面板中,有几个选项转到 Basic options -> C++ Standard 将其值从 C++ 11 更改为 C++ 98