Mingw Setup Instant
Under , find and select the Path variable, then click Edit . Click New and paste the path you copied ( C:\MinGW\bin ). Click OK on all windows to save. 3. Verify Installation Open a new Command Prompt or PowerShell window. Type g++ --version or gcc --version and press Enter.
For many developers, MinGW (Minimalist GNU for Windows) is the gateway to professional C and C++ development on the Windows operating system. Unlike heavy Integrated Development Environments (IDEs), MinGW provides a lightweight, native port of the GNU Compiler Collection (GCC), allowing you to build high-performance applications without the overhead of third-party runtime dependencies like Cygwin.
gcc --version g++ --version gdb --version mingw setup
The most modern and recommended method is using MSYS2, which provides a package manager (pacman) to keep your compiler and libraries up to date.
To use the gcc or g++ commands in your command prompt, you must add the MinGW bin folder to your environment variables. Under , find and select the Path variable, then click Edit
g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 13.2.0 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
There are two primary ways to set up MinGW on modern Windows systems (10 or 11): Option A: Manual Installation (MinGW-w64 via MSYS2) For many developers, MinGW (Minimalist GNU for Windows)
| Task | Command | |------|---------| | Compile C | gcc file.c -o output.exe | | Compile C++ | g++ file.cpp -o output.exe | | Enable warnings | g++ -Wall file.cpp -o output.exe | | Debug symbols | g++ -g file.cpp -o output.exe | | Optimize | g++ -O2 file.cpp -o output.exe | | Run debugger | gdb output.exe |
