Computer Programming web Web programming Tips

How to use the CodeBlocks open source compiler for a C++ project

By Sergey Skudaev

Let us create the same application using CodeBlocks open source IDE. Download and install the CodeBlocks software from website. There is an instruction for the installation, so you should not have any problems.

When you start the CodeBlocks application a window as below is displayed.

Click Create a new project link. On the next window select the Console application and click Go button.

The Project templates window. The Console application is selected.

Select C++ for a language selection.

Enter project name and click Next button.

Select GNU GCC Compiler in the compiler drop down list and click Finish button.

The project is created. Select the project and open main.cpp file.

Enter a code as in the example below.

Save the file by clicking the Save icon on the main tool bar.

From the main menu select Build, then Rebuild and your code will be compiled.

Click Yes to agree to rebuild the project.

If there are any errors, they will be displayed at the bottom of the window. If there is no error then you can run your program.

From main menu select Build, then Build and run. The command prompt window displays the tree.

Now you know how to use CodeBlocks IDE.

My eBooks on

Subscribe to our mail list to receive free code examples.


No comments yet.

Add Comment

* Required information
(never displayed)
Smile Sad Huh Laugh Mad Tongue Crying Grin Wink Scared Cool Sleep Blush Unsure Shocked
Out of 56, 14 or 27, which is the smallest?
Enter answer:
Enter code:
Notify me of new comments via email.
Remember my form inputs on this computer.
I have read and understand the privacy policy. *
I have read and agree to the terms and conditions. *
Powered by Commentics