How to write and compile a C++ program in Windows using an IDE
In this tutorial I’ll show you how to write and compile a C++ Program using CodeBlocks in Windows. That’s right, Windows.
If you haven’t done so, download and install CodeBlocks
Using CodeBlocks to program Hello World
1. Open up CodeBlocks and simply click on “Create a new project”.

2. In the following window choose Console Application.

3. The next window welcomes you to the application wizard. I’d simply check Skip this Page Next Time and click on Next.

4. Choose C++ project.

5. Type in the appropriate values I have in the following image. If you want, you can change the name of the directory where your project will be saved.

6. For now, simply type in Finish in the next window. No need to change anything.

7. In the Management Tab, Expand Sources, and double click on main.cpp . Unfortunately Hello World is already written for us!

8. Now go to Build -> Build and Run. OR You can simply hit F9 which is the shortcut to build and run your program.

9. Congratulations! You are done!
Useful Resources
C++ Tutorial – Page where our C++ tutorials can be found at.
Hello World – Step by Step telling you what each line of Hello World actually does!



June 2nd, 2008 at 4:46 pm
Quick tip.
At the top of this tutorial you tell the reader to download code blocks if they don’t have it. If someone has never used code blocks maybe they don’t know how to set it up. It would be really useful if you had a link to a tutorial that teach the user how to set up code blocks.The edit might look something like this:
In this tutorial … That’s right, Windows.
If you haven’t done so, download and install CodeBlocks. If you are not familiar with code blocks click here for a quick guide on how to set it up.
Just a suggestion… :)
June 27th, 2008 at 11:35 am
If they download the one with the compiler then they should be fine.
July 6th, 2008 at 1:13 am
Thanks, this was very useful.
May 17th, 2009 at 6:17 am
Sorry!
I try for about an hour but only get
“test1 – Release” uses an invalid compiler. Skipping…
Nothing to be done.
I am not good in computer. Would you mind to give me some help?
I use Windows XP
May 17th, 2009 at 9:40 am
Did you download CodeBlocks with MinGW? (The compiler) ?
May 30th, 2009 at 11:14 am
I was able to download and install codeblocks with MinGW, and was able to see the “Hello World!” program, but same with CKKwok, I got a “7 – Debug” uses an invalid compiler… Skipping…
Anyone who can help?