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:
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.
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:
You should see an output as shown:
Congratulations, you have successfully installed MinGW on your system.
This guide covered how you can download and install the MinGW development environment on Windows.
Stay tuned for more!!