If you want a real Unix-like C/C++ development environment on Windows, one of the best setups is MSYS2 with the MinGW-w64 toolchain.
This gives you:
- GCC and G++
- Binutils
- Make
- GDB
- Unix shell tooling
- A package manager (
pacman) - A workflow close to Linux development
This is the same type of environment many systems programmers, compiler developers, emulator developers, and operating system engineers use on Windows.
Step 1 — Install MSYS2
Download and install MSYS2 from:
After installation, open:
MSYS2 MINGW64
Do not use regular CMD for this setup.
Step 2 — Update the System
Run:
pacman -Syu
This updates the core MSYS2 packages.
Sometimes MSYS2 will ask you to close the terminal after the first update.
If that happens:
- Close the terminal
- Reopen
MSYS2 MINGW64 - Continue with:
pacman -Su
Step 3 — Install Build Essentials
Now install the Unix build tools:
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
This installs:
- GCC
- G++
- Binutils
- Make
- GDB
- Headers
- Runtime libraries
- pkg-config
- Unix build utilities
When prompted:
Enter a selection (default=all):
Just press:
Enter
to install everything.
Step 4 — Verify Installation
Check the tools:
gcc --version
g++ --version
ld --version
make --version
gdb --version
You should now see installed versions.
Example:
gcc (Rev10, Built by MSYS2 project) 16.x.x
Step 5 — Compile Your First C Program
Create a file:
nano hello.c
Paste:
#include <stdio.h>
int main() {
printf("Hello from GCC on MSYS2\n");
return 0;
}
Save with:
CTRL + O
ENTER
CTRL + X
Compile:
gcc hello.c -o hello.exe
Run:
./hello.exe
Output:
Hello from GCC on MSYS2
Step 6 — Compile C++
Create:
nano hello.cpp
Paste:
#include <iostream>
int main() {
std::cout << "Hello C++" << std::endl;
return 0;
}
Compile:
g++ hello.cpp -o hello.exe
Run:
./hello.exe
What You Installed
GCC
The GNU Compiler Collection.
Used for:
- C
- C++
- Objective-C
- low-level systems programming
Binutils
The low-level binary tooling:
-
ld→ linker -
as→ assembler objdumpnmar
These tools are essential for:
- OS development
- reverse engineering
- embedded systems
- compiler work
Make
Build automation.
Example:
all:
gcc main.c -o app
Run with:
make
GDB
The GNU Debugger.
Debug programs:
gdb ./hello.exe
Why MSYS2 Is Powerful
MSYS2 gives Windows a Unix-style developer workflow.
You get:
- Bash shell
- Linux-like package management
- GCC toolchains
- POSIX tooling
- easier open-source development
This is especially useful for:
- compiler development
- kernels
- emulators
- game engines
- systems software
- runtime environments
- custom operating systems
Bonus — Useful Packages
Install Git:
pacman -S git
Install CMake:
pacman -S mingw-w64-x86_64-cmake
Install NASM:
pacman -S nasm
Install Clang:
pacman -S mingw-w64-x86_64-clang
Final Thoughts
Learning C build tooling is one of the most important steps toward understanding how software actually works underneath modern frameworks.
Once you understand:
- compilers
- assemblers
- linkers
- object files
- runtimes
- loaders
you stop treating software like magic.
You start seeing the machine underneath the abstraction.
Top comments (0)