Compiling g++ 4.6.2 for -std=c++0x

I want to start working with C++11, but right now I can't seem to find much in the way of IDE's that have the new standard. I would like to compile g++ 4.6.2 from http://gcc.gnu.org, but the instructions are a bit beyond my expertise level. If someone is willing to assist me in compiling, or if anybody has any suggestions for an IDE that I can use that has the ability to use the -std=c++0x switch properly, I would appreciate it.
Get an IDE that allows you to select the compiler yourself. I suggest Code::Blocks coupled with the latest version of gcc.
I have Code::Blocks, but it doesn't seem to support that functionality...unless I'm missing something? In any case, Code::Blocks doesn't have a compiler, I would still need to have someone help me to install g++ 4.6.x.
If it doesn't have the option for you choose a compiler, and also doesn't have a compiler of its own, how could it possibly ever compile anything? :)

Try looking under "Settings -> Compiler and debugger settings" or some such. Near the top, you can pick your compiler.

As for installing the latest gcc - which *nix dist are you using?


Last edited on
Simple answer is that Code::Blocks doesn't compile anything. It interfaces with the compiler that your system may or may not have already installed, which is g++ 4.5.x.

I'm using Linux Mint Debian 11.04.

I made an attempt at making the compiler, but I think I messed something up. When I use gcc --version it says that my C compiler is 4.6.2, but with g++ --version, it's 4.5.x (I'm on another computer atm, don't have the exact version). When I attempt to force it to use the install of 4.6.2 that I have, it's missing files.
Simple answer is that Code::Blocks doesn't compile anything.

Yes, clearly, that's my point. It interfaces with the compiler you tell it to from the selection. If you tell it to use a compiler that supports C++11, it'll do so.

I've never used Mint, but I understand it's an Ubuntu derivative, and there are lots of people on the web who've written about building gcc 4.6 for Ubuntu 11.04 (and may even have it in a handy PPA).

This: http://buildall.wordpress.com/2011/05/03/installing-gcc-4-6-in-the-ubuntu-11-04-natty-narwhal/
and this: http://buildall.wordpress.com/2011/04/20/installing-gcc-4-6-in-the-ubuntu-10-10/
seem particularly relevant.
Last edited on
If you are going to compile gcc why not pick gcc 4.7 that has better support for C++11? I don't remember exactly how to compile gcc but there is some configure script you have to use. You will probably have to install some libraries that is needed but let the configure script tell you what is missing and install that. Compiling gcc can take hours just so that you know.
@Moschops: (Like) This is the sort of comprehensive instructions that I haven't been able to find so far. Thank you so much for pointing me in the right direction!

@Peter87: Because gcc 4.7 doesn't exist yet. http://gcc.gnu.org/releases.html
The source code is available so you can just download it, but do as you want.
These posts, combined with http://www.cplusplus.com/forum/beginner/31758/ have allowed me to be able to use my favorite IDE to compile code with C++11. Thanks big time to Moschops.
Topic archived. No new replies allowed.