MinGW(Minimalist GNU for Windows) is a native development environment that includes a porting of the famousc/C+ compiler (GCC). Provides freely distributed import libraries and header files, essential for creatingnative 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 onSourceForge to download MinGWand click the buttonDownload. The installation executable file download will begin automatically within 5 seconds.

Step 2:Double-click the file.exejust downloaded to open the installer and clickInstall. 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, clickContinue. At this point, the interface of theMinGW Installation Manager, the compiler package manager.

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

Step 5:Click on the menuInstallationtop left, choose the optionChangeand then confirm by selectingApply. The manager will begin to download all the necessary files; the process may take 5-6 minutes depending on the connection. Once completed, clickClose.

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

Step 2:Go toControl panel, access the sectionSystem and safetyand thenSystem. Click onAdvanced System Settingsfrom the side menu and finally click on the buttonEnvironmental variables..down.

Step 3:In the box dedicated toSystem variables, look for the voicePath, select it and clickEdit. Add a new record by clickingNew. Paste the folder pathbincopied earlier and click onOKin 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 doorDisco C:, look for the folderMinGW. Inside, access the folderbinand copy the route (usuallyC:\MinGW\bin).

Step 2:Click on the iconThis PC, right click in a blank space and selectShow other options(if present), then click onPropertyas indicated by the arrow.

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

Step 4:Click the buttonEnvironment variablesplaced at the bottom of the window.

Step 5:Now, in the bottom paneSystem variables, search and select the variablePath, then click on the buttonEdit.

Step 6:Click on the buttonNewand paste the previously copied path as below screenshot shown.

Now click onOKin succession for passages 6, 5 and 4. Finally, close all windows open andrestart your computerto 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 theCommand Prompt(cmd) or PowerShell on Windows and type the commandgcc --versionorg++ --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 packagesmingw32-base-bin(which contains the basic C compiler) andmingw32-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.






