Computer Programming web Web programming Tips



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

By Sergey Skudaev

Happy Amazon Prime Day July 12 - Exclusive Deals for Prime Members - Start Free 30-Day Trial

Let us create the same application using CodeBlocks open source IDE. Download and install the CodeBlocks software from codeblocks.org 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.

Subscribe to our mail list to receive free code examples.

Comments

No comments yet.

Add Comment

* Required information
(never displayed)
 
Smile Sad Huh Laugh Mad Tongue Crying Grin Wink Scared Cool Sleep Blush Unsure Shocked
 
1000
Enter the third letter of the word castle.
 
Enter answer:
Captcha
Refresh
 
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

My eBooks on Amazon.com

Learn C++ Programming By Examples

Learn SQL Programming By Examples

Learn PHP Programming by Examples

Visual Basic Programming By Examples

How to Build Your Own Web Site from Scratch