DEV Community

Prabhat Shrestha
Prabhat Shrestha

Posted on • Edited on

Install MinGW-w64 on Windows 11

AT First

When I usually program in C++, I use Visual Studio Community. It’s free for personal use, and I really like that you can set breakpoints with the F9 key and press F5 to automatically build and run your program. Visual Studio Community is an extremely convenient and powerful IDE, but if you want to use it commercially with a team, you need a paid license. If you absolutely want to create commercial programs for free, you can use MinGW-w64, CMake, and Visual Studio Code as an alternative to Visual Studio Community.
As for MinGW-w64, the installation method tends to change from time to time, so I’d like to write down the method I tried this time as a memo ON 2025 November.

Download

Download the MinGW-w64 from the following site:
https://www.mingw-w64.org

It seems that clicking on w64devkit will take you to the github site.
https://github.com/skeeto/w64devkit
Installation file can be downloaded from the “Releases” section in the lower right corner.

Installation

Launch the installer (Double click on downloaded exe file), will be asked where to install it. Enter the name of the folder you want to install.


Replace "C:\Tools" to your own location in the whole content. You can use the same location.
In my case, MinGW-w64 is installed in "C:\Tools\w64devkit"

Adding a Path for an Environment Variable

To compile C++ from the "Command Prompt", MinGW-w64 directory should be added to the path of the environment variable.

  1. Press Windows + R, type sysdm.cpl, and press Enter.

  2. In the System Properties window, click on Advanced tab -> Environment Variables.

  3. Under the “System variables” section, find and select Path, then click Edit.

  4. Click New, then paste the following path:
    Your
    C:\Tools\w64devkit\bin

  5. Click OK on all open windows to save the changes.

  6. Restart PC.

Installation Verify

Open command prompt and run g++ --version

c:\Users\Username>g++ --version
g++ (GCC) 15.2.0
Copyright (C) 2025 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.
Enter fullscreen mode Exit fullscreen mode

## Run Code
Save the following Sample Code to hello.cpp in a folder.

#include <iostream>
int main() {
    std::cout << "Hello, World!\n";
    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Write "cmd" on address bar of the folder and run following command to compile code.
g++ hello.cpp -o hello.exe

c:\Users\Username>g++ hello.cpp -o hello.exe
Enter fullscreen mode Exit fullscreen mode

Run the program

c:\Users\Username>hello
Hello, World!
Enter fullscreen mode Exit fullscreen mode

End. Thank you for reading.


Created on : 2025/11/04
Last updated on : 2025/11/09

Top comments (0)