问题
I'm using code blocks with gnu gcc compiler. But when I try to compile a range base for startment it gives many errors. So I think the compiler dosn't support C++0x. So I want to know how to know the compiler version I'm using and how to update it correctly to a C++0x supporting one. I'm using Windows XP.
回答1:
This algorithm may help to start with programming with C++11 on Windows:
1) Go to http://mingw.com and download the latest MinGW distribution, install it
2) Download the CodeBlocks installer, install it. During installation it should detect GCC installation and propose to use it as default compiler, accept this.
3) Start a new CodeBlocks project, go to Project -> Properties -> Build options -> Compiler settings -> Compiler flags, then set flag "Have g++ follow the coming C++0x ISO C++ language standard"
4) Compile your first C++11 project and have fun!
By the way, the latest MinGW g++ is of version 4.6.1 as for now, so it has to support most of C++11 features.
来源:https://stackoverflow.com/questions/12822851/gnu-gcc-compiler-updating