如何用g ++编译器编译c11 iso标准代码

系统细节:

$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 DISTRIB_CODENAME=precise DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS" $ g++ --version g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 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. 

根据您希望使用的C ++ 11的哪些部分,您需要传入一个额外的开关:

 -std=c++0x 

g ++ 4.7及更高版本使用:

 -std=c++11 and -std=gnu++11 

像这样的编程特定问题可能更适合stackoverflow.com。

http://gcc.gnu.org/projects/cxx0x.html

    Interesting Posts