Object Oriented Programming – C++ Practical Lab 0
Install Code::Blocks
Assigned: Sept 4, 2025
In this lab we will install the Code::Blocks C++ compiler.
Part 1 – Download the installer
1. Visit the following website:
[Link]
2. Click on “[Link]” or “[Link]” next to
“[Link]”
(See below). Note that “[Link]” is likely to be faster. Be sure you choose the correct row!
3. Save and Run the file, “[Link]”.
Part 2 – Install Code::Blocks.
4. After running the file, click “Next”, then “I Agree”.
5. Verify that “MinGW Compiler Suite” is included. If it is not available, then go back and
follow the instructions in Part 1 again. Be sure to download the correct file.
6. Click “Next”, then “Install”
7. Code::Blocks should install. After the installation is finished, click “Yes” to run
Code::Blocks now, or “No” to run the program later.
Part 3 – Run and Configure Code::Blocks for the first time.
8. The first time you run Code::Blocks, the compiler auto-detection and configuration should
run automatically. If it doesn't, go to Step 12, where you can choose the compiler.
9. Select “GNU GCC Compiler” and click “OK”. You might get a message that the compiler
is not found. If so, then we can fix this later.
10. Choose “Yes, associate Code::Blocks with every supported type”, unless you are using
another IDE on this computer. If you are using another IDE for a different programming language
on this computer, then choose “Yes, associate Code::Blocks” with C/C++ file types.
11. Click “OK”. Code::Blocks should start.
12. Click the “Settings” menu, then “Compiler...”
13. If “GNU GCC Compiler” is not the Selected compiler, then choose it now.
14. Choose the “Toolchain executables” tab.
15. Click “Auto-detect”. Code::Blocks should find the directory of the compiler.
16. Click “OK”, then “OK”.
Part 4 – Write, Compile, and Run a small program.
17. Click “File” → “New” → “Project” (or choose “Create a new project” from the center of the
window).
18. Choose “Empty Project”, and click “Go”.
19. Click “Next”.
20. Enter “Hello” for the Project Title.
21. Click “…” next to “Folder to create project in. Choose a directory where you want to save
the project. It is a good idea to create a directory called “Hello”, and then choose this directory.
22. Click “Next” and “Finish”.
23. Click “File” → “New” → “Empty File”
24. Click “Yes” to add this file to the project.
25. Save the file as “[Link]”. Click “OK” then “OK”.
26. Write the following code into the editor:
// [Link]
// This program prints "Hello“
#include <iostream>
using namespace std;
int main()
{
cout << "Hello" << endl;
return 0;
}
27. Click “File” → “Save file”
28. Click “Build” → “Build”
If there is any error, check your code for mistakes.
29. Click “Build” → “Run”
The program should print the word “Hello”.
If you are using an antivirus program, it may give you a warning now. However, it is safe to run
this program which you yourself have written.