How To Install C++ Compiler Using Code Block

Code::Blocks : is a cross-platform IDE that supports compiling and running multiple programming languages.

It is available for download from: http://www.codeblocks.org/

Code::Blocks can work with a variety of compilers.

For Windows, it is offered optionally with the MinGW compiler. This version that includes MinGW is sufficient to follow these tutorials, letting you compile the examples right away. If unsure, download the one named “codeblocks-XX.XX-mingw-setup.exe”.

For Linux and Mac users, download the version corresponding to your distribution.

Installation  : On Windows, run the downloaded executable file, and follow its instructions. The default options are fine.

Support for C++11  : If you have a version of GCC as compiler (such as MingW for Windows), chances are it will come with support for the most recent version of C++ disabled by default. This can be explicitly enabled by going to:

Settings -> Compiler… 

And here, within “Global compiler settings”, in “Compiler settings” tab, check the box “Have g++ follow the C++11 ISO C++ language standard [-std=c++11]”:

Console Application :

To compile and run simple console applications such as those used as examples in these tutorials it is enough with opening the file with Code::blocks and hit F9.

As an example, try:

File -> New -> Empty File

There write the following:

#include <iostream>

int main()

{

auto x = R”(Hello world!)”;

std::cout << x;

}

Edit & Run

Then:

File -> Save file as…

And save it with some file name with a .cpp extension, such as example.cpp.

Now, hitting F9 should compile and run the program.


 To download the Compiler press here :

http://www.mingw.org/category/wiki/download

MinGW, a contraction of “Minimalist GNU for Windows”, is a minimalist development environment for native Microsoft Windows applications.

MinGW provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs. (It doesdepend on a number of DLLs provided by Microsoft themselves, as components of the operating system; most notable among these is MSVCRT.DLL, the Microsoft C runtime library. Additionally, threaded applications must ship with a freely distributable thread support DLL, provided as part of MinGW itself).

MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes. MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows. If you want POSIX application deployment on this platform, please consider Cygwin instead.

Primarily intended for use by developers working on the native MS-Windows platform, but also available for cross-hosted use, (see note below — you may need to follow the “read more” link to see it), MinGWincludes:

  • A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
  • GNU Binutils for Windows (assembler, linker, archive manager)
  • A command-line installer, with optional GUI front-end, (mingw-get) for MinGW and MSYS deployment on MS-Windows
  • A GUI first-time setup tool (mingw-get-setup), to get you up and running with mingw-get.

MSYS, a contraction of “Minimal SYStem”, is a Bourne Shell command line interpreter system. Offered as an alternative to Microsoft’s cmd.exe, this provides a general purpose command line environment, which is particularly suited to use with MinGW, for porting of many Open Source applications to the MS-Windows platform; a light-weight fork of Cygwin-1.3, it includes a small selection of Unix tools, chosen to facilitate that objective.