Code::Blocks is a free, standalone C and C++ IDE that is perfect for beginners — because the recommended installer comes with a compiler built in. Unlike VS Code, you do not need to install GCC separately or configure anything: download one file, install it, and you are writing and running C programs in minutes.
This guide covers downloading, installing, and writing your first C program in Code::Blocks on Windows.
Why Choose Code::Blocks?
Code::Blocks is the easiest way to start C programming on Windows because the mingw-setup version bundles MinGW (the GCC compiler) with the editor. Everything works out of the box:
- No separate compiler setup — GCC is included and pre-configured
- One-click build and run — compile and execute with a single button
- Lightweight — runs well even on older or low-spec machines
- Free and open source — no accounts, no cost
If you would rather use a more modern, extensible editor (and do not mind installing the compiler yourself), see our VS Code for C programming guide instead. And if you just want to test a quick program with nothing to install, try an online C compiler.
Step 1 — Download Code::Blocks (with the Compiler)
Go to the official site codeblocks.org/downloads/binaries. Under the Windows section, download the file whose name ends in mingw-setup — currently:
codeblocks-25.03mingw-setup.exe
This is the important step. There are two installers — one with mingw in the name and one without. The mingw-setup version includes the GCC compiler. If you download the plain version by mistake, Code::Blocks will install but have no compiler, and you will not be able to build programs.
Step 2 — Install Code::Blocks
- Run the downloaded
.exe - Click through Next and accept the licence
- Leave the default components selected (this includes the MinGW compiler) and finish the install
- Launch Code::Blocks
On first launch, Code::Blocks detects the bundled GNU GCC compiler and selects it automatically. If it asks, choose GNU GCC Compiler and set it as default.
Step 3 — Create Your First Project
You can compile a single file, but the cleanest way to work is with a project:
- Go to File → New → Project…
- Select Console application and click Go
- Choose C (not C++) and click Next
- Give the project a title and choose a folder to save it in
- Leave the compiler as GNU GCC Compiler and click Finish
Code::Blocks creates a project with a ready-made main.c containing a Hello World program.
Step 4 — Write Your Program
Open main.c from the left-hand project panel and replace its contents with:
#include <stdio.h>
int main(void) {
printf("Hello from Code::Blocks!\n");
return 0;
}
Step 5 — Build and Run
Press F9 (Build and Run), or click the Build and Run button (the gear-and-play icon) in the toolbar. Code::Blocks compiles your program and opens a console window showing:
Hello from Code::Blocks! Process returned 0 (0x0) execution time : 0.012 s Press any key to continue.
The “Press any key to continue” line is Code::Blocks keeping the console open so you can read the output — a small but helpful touch for beginners.
Useful Code::Blocks Shortcuts
| Key | Action |
|---|---|
| F9 | Build and run |
| Ctrl+F9 | Build only (compile without running) |
| Ctrl+F10 | Run the last built program |
| F8 | Start the debugger |
| F7 | Compile the current file |
Using the Debugger
Code::Blocks includes the GDB debugger. Click in the margin to the left of a line number to set a breakpoint (a red dot), then press F8. Execution pauses at the breakpoint, and you can open Debug → Debugging windows → Watches to inspect variable values as you step through with F7. This is one of the best ways to understand how loops, arrays, and pointers actually behave.
Common Issues
| Problem | Fix |
|---|---|
| “No compiler found” or cannot build | You installed the version without MinGW — reinstall using the mingw-setup installer |
| Compiler not auto-detected | Go to Settings → Compiler → Toolchain executables and confirm the path points to the bundled MinGW folder |
| Console window flashes and closes instantly | Run with F9 (Build and Run) — Code::Blocks adds the “Press any key” pause automatically |
| Want to compile just one file without a project | Open the .c file and press F9; choose to build it directly when prompted |
Code::Blocks vs VS Code — Which Should You Use?
| Code::Blocks | VS Code | |
|---|---|---|
| Compiler included | Yes (mingw-setup) | No — install GCC separately |
| Setup effort | Minimal — works out of the box | Moderate — extension + config |
| Best for | Beginners, quick start, low-spec PCs | Modern features, extensions, long-term use |
| Languages | C / C++ focused | Everything (with extensions) |
Start with Code::Blocks if you want to begin coding immediately with zero configuration. Move to VS Code later if you want a more modern, extensible setup. For a full comparison of every option, see Best Free C IDEs for Beginners.
What’s Next
Your IDE is ready. Time to write real programs — browse our full list of C programs with examples, and try setting a breakpoint inside a sorting program to watch the array change step by step.
As an Amazon Associate we earn from qualifying purchases.
Recommended Book
With your IDE set up, the best book to learn C properly is The C Programming Language by Kernighan and Ritchie (K&R). For more options across every level, see our guide to the best C programming books.