MinGW (Minimalist GNU for Windows) is a native development environment that includes a porting of the famous c/C+ compiler (GCC). Provides freely distributed import libraries and header files, essential for creating native applications for Windows. In this practical tutorial, we will guide you through all the steps needed to successfully install and configure MinGW on your device.
How to install MinGW tools for C/C + +
Step 1: Visit the official project page on SourceForge to download MinGW and click the button Download. The installation executable file download will begin automatically within 5 seconds.

Step 2: Double-click the file .exe just downloaded to open the installer and click Install. The system will automatically start downloading all the preliminary configurations necessary for the operation of MinGW.
Step 3: After all basic configurations have been downloaded, click Continue. At this point, the interface of the MinGW Installation Manager, the compiler package manager.

Step 4: In the installation manager, under the section Basic Setup, right-click each essential package for programming (such as mingw32-base and mingw32-gcc-g++) and select “Mark for Installation” to mark them.

Step 5: Click on the menu Installation top left, choose the option Change and then confirm by selecting Apply. The manager will begin to download all the necessary files; the process may take 5-6 minutes depending on the connection. Once completed, click Close.

How to change environment variables for MinGW
After completing the installation of MinGW, the next and fundamental step is to update the windows environment variables. This will allow the system to globally recognize compiler commands.
Step 1: Open File Explorer, login to Local disc (C:) of your device and open the folder MinGW. Inside, enter the folder called bin and copy the whole path from the top address bar.

Step 2: Go to Control panel, access the section System and safety and then System. Click on Advanced System Settings from the side menu and finally click on the button Environmental variables.. down.

Step 3: In the box dedicated to System variables, look for the voice Path, select it and click Edit. Add a new record by clicking New. Paste the folder path bin copied earlier and click on OK in all windows open to save.

This marks the completion of the basic installation of MinGW in your operating system.
Another method to change environment variables for MinGW
If you use more recent versions of Windows, you may prefer this alternative method.
Step 1: Open the door Disco C:, look for the folder MinGW. Inside, access the folder bin and copy the route (usually C:\MinGW\bin).

Step 2: Click on the icon This PC, right click in a blank space and select Show other options (if present), then click on Property as indicated by the arrow.

Step 3: On the system information screen, click on the link Advanced System Settings.

Step 4: Click the button Environment variables placed at the bottom of the window.

Step 5: Now, in the bottom pane System variables, search and select the variable Path, then click on the button Edit.

Step 6: Click on the button New and paste the previously copied path as below screenshot shown.

Now click on OK in succession for passages 6, 5 and 4. Finally, close all windows open and restart your computer to apply changes.
This marks the definitive completion of the installation of MinGW in your Windows environment, making it ready for C and C++ compilation.
Last update: 06 February 2023.
Frequently Asked Questions (FAQ) about MinGW
What is MinGW for and why is it important for C/C++ programmers?
MinGW (Minimalist GNU for Windows) provides an essential set of open source compilers, including GCC and G++, optimized for Microsoft operating systems. It is crucial because it allows developers to write and compile native Windows applications without relying on proprietary C libraries.
How can I check if MinGW has been installed and configured correctly?
To ensure that your operation is correct, open the Command Prompt (cmd) or PowerShell on Windows and type the command gcc --version or g++ --version. If the system returns the version of the compiler installed, the installation and setting of the environment variables went well.
What packages should I select in the MinGW Installation Manager to start programming?
For standard development operations in C and C++, you just need to check the packages mingw32-base-bin (which contains the basic C compiler) and mingw32-gcc-g++-bin (to support C++ languages). Other packages offer support for languages like Fortran or Ada and can be ignored if not necessary for your projects.






