The first step is to visit the following MinGW website: https://www.mingw-w64.org/
From there download and install one of the pre-built Windows packages found here: https://www.mingw-w64.org/downloads/
One of the options on that downloads page is the packages found here: https://winlibs.com/
For example, these are the steps needed to install one of the packages found on the WinLibs page.
Step 1) Downloading and installing the 64-bit version of the GCC 15.1.0 (with POSIX threads) + MinGW-w64 13.0.0 UCRT package and unzip that file to a suitable folder.
Code: Select all
c:\MinGW
Code: Select all
c:\MinGW\bin
Step 3) Test the PATH settings using the Windows Start Button and run the cmd executable to bring up a command prompt.
To test the C compiler run the following command line:
Code: Select all
gcc.exe --version
Code: Select all
gcc.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r2) 15.1.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.
Code: Select all
g++.exe --version
Code: Select all
g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r2) 15.1.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.
If this happens, check the installation bin folder making sure it contains these executables and also make sure the bin folder has been correctly added to the PATH.
Step 4) Test the compiler by creating a simple c:\temp\test.cpp test file using the C++ code shown below:
Code: Select all
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world..." << endl;
return 0;
}
Code: Select all
cd c:\temp\
g++.exe test.cpp -o test.exe
dir test.exe
Running those commands should produce the following output:
Code: Select all
c:\>cd c:\temp\
c:\Temp>g++.exe test.cpp -o test.exe
c:\Temp>dir test.exe
Volume in drive D is DATA
Volume Serial Number is 06EC-1105
Directory of c:\Temp
21/05/2016 02:30 PM 2,707,662 test.exe
1 File(s) 2,707,662 bytes
0 Dir(s) 1,824,970,645,504 bytes free
Code: Select all
Hello world...