Here’s a step-by-step guide:
🧩 Step 1: Choose Which MinGW You Want
There are two main distributions:
- MinGW (Original) — older and less frequently updated.
- Website: http://www.mingw.org/
- Installer name:
mingw-get-setup.exe
- MinGW-w64 (Recommended) — actively maintained, supports both 32-bit and 64-bit Windows.
- Official SourceForge page: https://sourceforge.net/projects/mingw-w64/
- Alternatively, the MSYS2 distribution provides a more modern environment using MinGW-w64.
For most users, MinGW-w64 (or MSYS2) is the best choice.
⚙️ Step 2: Download MinGW-w64 Installer
- Go to https://sourceforge.net/projects/mingw-w64/
- Click Download Latest Version — it will automatically download a file like:
mingw-w64-install.exe - Run the installer.
🖥️ Step 3: Configure Installation
When the installer launches:
- Version: Choose the latest (e.g.,
8.1.0or newer) - Architecture: Select
x86_64(for 64-bit Windows) - Threads:
posix - Exception:
seh(for 64-bit) - Build revision: Latest available
- Installation directory: e.g.
C:\mingw-w64
Click Next and wait for it to finish.
🔧 Step 4: Add MinGW to PATH
- Open Start Menu → Edit the system environment variables
- Click Environment Variables
- Under System Variables, find and edit
Path - Click New and add:
C:\mingw-w64\bin - Click OK to save.
✅ Step 5: Verify Installation
Open Command Prompt (cmd) and type:
gcc --version
If it prints the version (e.g. gcc (x86_64-posix-seh-rev0) 8.1.0), you’re good to go.
💡 Alternative: Install via MSYS2 (Recommended for Developers)
If you want a more powerful environment with package management:
- Go to https://www.msys2.org/
- Download and install MSYS2.
- Run:
pacman -Syu pacman -S mingw-w64-ucrt-x86_64-gccThis gives you the latest MinGW-w64 toolchain managed bypacman.