gcc

Gnu Compiler Collection

The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of theGNU toolchain. As well as being the official compiler of the unfinished GNU operating system, GCC has been adopted as the standard compiler by most other modern Unix-like computer operating systems, including Linux, the BSD family and Mac OS X.

GCC has been ported to a wide variety of processor architectures, and is widely deployed as a tool in commercial, proprietary and closed source software development environments. GCC is also available for most embedded platforms, for example Symbian (called gcce), AMCC and FreescalePower Architecture-based chips.The compiler can target a wide variety of platforms, including videogame consoles such as the PlayStation 2 and Dreamcast. Several companies make a business out of supplying and supporting GCC ports to various platforms, and chip manufacturers today consider a GCC port almost essential to the success of an architecture.

Originally named the GNU C Compiler, because it only handled the C programming language, GCC 1.0 was released in 1987, and the compiler was extended to compile C++ in December of that year. Front ends were later developed for Fortran, Pascal, Objective-C, Java, and Ada, among others.

More on wikipedia

g++

g++ is the traditional nickname of GNU C++, a freely redistributable C++ compiler. It is part of GCC, the GNU compiler suite, and is currently part of that distribution.

A lot of C++0x features are not available in VS 2010 SP1 but can be tried out in GCC 4.6

In this post I want to cover installation of GCC 4.6 on windows and how to get started with it. Hence forth we will see code on both the compilers, g++ and cl.

Getting GCC & Code Blocks IDE

Please download the windows binary from: ftp://ftp.equation.com/gcc, at the point of writing this post latest one is gcc-4.6.0-64.exe, this GCC 4.6 64bits binary.

After downloading install it to some convenient location, for eg: c:gcc, after completing the installation  now download CodeBlocks IDE from here. Please download the bare-minimum since we have our own compiler.

Setting up Code Blocks

Launch Code Blocks and go to Settings menu –> Compiler & debugger settings:

image

Specify the location of compiler, in my case it is J:gccgcc4.6 but yours can be different

To compile code with C++0x extensions we need to pass an option to compiler during compilation, this can be specified as:

image

Click on Add and type std for Key and c++0x for value, note case is important.

And now you are all set for some serious C++0x development.