How to Install GCC/G++ MinGW on Windows
To use via PowerShell or CMD with VS Code and/or others.
The default compiler for Microsoft Windows is MSVC and it is installed when we install Visual Studio. Despite being a very powerful IDE, I recommend it for almost all situations, some libraries are more practical to work with in a more minimalist environment and this can be achieved using GCC/G++ on Windows.
In this article we will see how to install on Windows 10 in the most basic and minimalist way possible!
Let’s go step by step!
1. Downloading MinGW
Access the address: https://sourceforge.net/projects/mingw-w64/ in the tab: Files and in MinGW-W64 GCC-8.1.0 (if you have a later version, choose her) and download the file: x86_64-posix-seh and after downloaded: unzip the file:
Move the unzipped folder to the
C:\ drive and copy the address of the
bin subfolder the full path is:
3. Create Environment Variables
Search the Startbar for the word Environment Variables , click on the first option and then on the button: Environment Variables, a new window will open:
In the bottom box (System Variables), select Path and click on the Edit button, in the window that opened click on the New button and paste the path address:
4. Testing in PowerShell and
Open PowerShell or CMD, enter the folder where there is a C/C++ file, compile and run:
In VS Code it is easier to use:
To facilitate the opening of PowerShell in VS Code you can install this extension.