How to install MinGW on Windows

In this guide, you will learn how to install and setup MinGW environment on your Windows machine.

How to install MinGW on Windows

Minimalist Gnu for Windows or MinGW is a free and open-source development environment that allows you to create native Windows applications. In addition, it provides access to the GCC compiler support on Windows systems and other tools necessary for development.

This tutorial will show you how to set up the MinGW environment on your Windows system.

Using the installer

The first and most popular method of installing MinGW is using the native installer. This installs all the required dependencies and adds the binaries to your system path.

Start by heading to the link provided below:

https://sourceforge.net/projects/mingw/

Select the Download button to begin the download process.

Once the download is complete, run the installer binary and follow the instructions on the installe window.

The installer will prompt you to select the components you wish to install. For a basic MinGW installation, you will need at least the C++ compiler (g++) and make utility (mingw32-make).

Once you have the target components, click on the installation tab and Apply Changes.

This will install the MinGW compiler and other necessary tools.

Using the archive

The second method you can use to set up MinGW is the provided archive. This is useful when setting up a portable MinGW environment or you do not want to make permanent changes to your system.

If you choose to install MinGW using the archive, first download the archive from the MinGW website.

https://sourceforge.net/projects/mingw-w64/files/latest/download

Once it has downloaded, extract it to a location of your choice. Preferably C:\MinGW. This ensures that all the users on that system have access to the MinGW binary without permission errors.

Inside the extracted folder, there will be several subfolders. We are interested in the "bin" folder containing the MinGW compiler and other tools.

After extracting the MinGW archive, you need to add the MinGW directory to your PATH environment variable allowing you to execute MinGW programs from any location.

To do this, open the Control Panel and go to system> Advanced system settings.

Under the "Advanced" tab, click on the "Environment Variables" button.

In the "System variables" section, locate the Path variable and select. Then, click on the Edit button to add a new entry.

Next, click on New and paste the path to the MinGW bin directory. If you extracted MinGW to the C directory, add the path as C:\MinGW\bin

Click "OK" to save your changes and close the dialog Windows.

You will now be able to run MinGW programs by simply typing their name at the command prompt.

Try it out by opening a new command prompt window and running the command:

 g++ --version

You should see an output as shown:

Congratulations, you have successfully installed MinGW on your system.

Conclusion

This guide covered how you can download and install the MinGW development environment on Windows.

Stay tuned for more!!

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.