How to Install C++ Code::Blocks in Windows
The C++ Code::Blocks environment comes in an easy-to-install, compressed executable file that is compatible with all versions of Windows after Windows 2000. Here’s the rundown on installing the environment:
Download the executable codeblocks-13.12.mingw-setup.exe.
Save the executable to your desktop or some other place that you can easily find it.
This includes the 4.71 version of the GCC compiler. This is not the newest version of GCC but it’s the version recommended by Code::Blocks. If you want the newer but perhaps slightly buggy 4.81 version, you can download and install codeblocks-13.12.mingw-setup-TDM-GCC-481.exe instead.
Double-click the program once it has completed downloading.
Depending on what version of Windows you’re using, you may get the ubiquitous An unidentified program wants access to your computer warning pop-up. If so, click Allow to get the installation ball rolling.
Click Next after closing all extraneous applications as you are warned in the Welcome dialog box to the Code::Blocks Setup Wizard.
Read the End User License Agreement (commonly known as the EULA) and then click I Agree if you can live with its provisions.
It’s not like you have much choice — the package really won’t install itself if you don’t accept. Assuming you do click OK, Code::Blocks opens a dialog box showing the installation options. The default options are fine.
Click the Next button.
The installation program allows you to install only some subset of the features. You must select at least the Default Install and the MinGW Compiler Suite. The default is to install everything — that’s the best choice.
If the MinGW Compiler Suite is not an option, then you must have downloaded a version of Code::Blocks that does not include gcc. This version will not work correctly.
Click Install and accept the default Destination Folder.
Code::Blocks commences to copying a whole passel of files to your hard drive. Code::Blocks then asks Do you want to run Code::Blocks now?
Click Yes to start Code::Blocks.
Code::Blocks now asks which compiler you intend to use. The default is GNU GCC Compiler, which is the proper selection.
From within Code::Blocks, choose Settings→Compiler.
Select the Compiler Flags tab.
Make sure that the following three flags are selected, as shown in the figure:
Enable All Compiler Warnings
Have g++ Follow the Coming C++0x ISO C++ Language Standard
Have g++ Follow the C++11 ISO C++ Language Standard
The C++ 2011 standard was originally supposed to be the C++ 2008 or 2009 standard. Since it wasn’t clear, the standard became known as the 0x standard. The standard wasn’t completely accepted until 2011. Within gcc, C++0x and C++11 refer to the same standard.
Select the Toolchain Executables tab. Make sure that it appears like in the following figure.
The default location for the gcc compiler is the MinGW\bin subdirectory of the Code::Blocks directory.
If the default location is empty, then Code::Blocks does not know where the gcc compiler is, and it will not be able to build your programs. Make sure that you downloaded a version of Code::Blocks that includes gcc and that you included MinGW during the installation.
If you are using an existing gcc compiler that you’ve already installed, then you will need to point Code::Blocks to where it is located on your hard drive.
Close the Settings dialog box.
Click Next in the Code::Blocks Setup dialog box and then click Finish to complete the setup program.
The setup program exits.