我用的系统是ubuntu 14.04, g++版本是4.8.4的,是支持C++11,我本身通常最经常使用的的C++编译器是g++和eclipseios
一,g++c++
g++ 在通常的编译命令中加入-std=c++11
,以下ubuntu
g++ -std=c++11 -o test test.cpp
二,eclipseeclipse
打开eclipse,依次设置测试
C/C++ Build > Settings > GCC C++ Compiler > Miscellaneous > other flages 加 -std=c++11 或 c++0x
ui
对于GCC C compiler, 类似的添加-std=gnu++11 而后点击 Apply。
spa
以下程序能够测试是否,用C++11修改过的auto特性c++11
#include <iostream> using namespace std; int main() { auto a = 10; cout << "%d\n",a; return 0; }
编译成功,即为设置成功.
code