简体   繁体   English

无法在G ++中使用-std标志进行编译

[英]Cannot compile using -std flag with g++

I'm running Windows 7 with cygwin installed and trying to have a play around with some of the newer C++ features. 我正在安装cygwin的Windows 7上运行,并尝试使用一些较新的C ++功能。 I'm aware that in order to enable these features I have to pass g++ the -std=c++0x flag, however that gives me the following error: 我知道,要启用这些功能,我必须传递g ++ -std = c ++ 0x标志,但是这给了我以下错误:

cc1plus: error: unrecognized command line option "-std=c++0x"

The command line I'm issueing that gives rise to that error is: 我发出的引起该错误的命令行是:

g++-3 hello.cpp -std=c++0x -o hello

The reason for the g++-3 is because windows has trouble with the symbolic link. 使用g ++-3的原因是因为Windows无法使用符号链接。 I've used g++ in the cygwin terminal and the result is the same anyway. 我在cygwin终端中使用了g ++,结果还是一样。

Any ideas? 有任何想法吗?

You need to be using a version of GCC which supports C++ 2011 features. 您需要使用支持C ++ 2011功能的GCC版本。

This page has a list of compilers and which features each one supports . 此页面列出了编译器以及每个编译器支持的功能 If I were you, I'd try to use GCC 4.7 if at all possible. 如果您是我,请尽可能尝试使用GCC 4.7。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM