How to Install GCC/G++ MinGW on Windows

To use via PowerShell or CMD with VS Code and/or others.

How to Install GCC/G++ MinGW on Windows

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.

The package developed by GNU to get you to use gcc/g++ on Windows is MinGW .

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: 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:

gcc/g++ MinGW Windows 1 gcc/g++ MinGW Windows 2

2. Installation

Move the unzipped folder to the C:\ drive and copy the address of the bin subfolder the full path is: C:\mingw64\bin

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: C:\mingw64\bin: gcc/g++ MinGW Windows 6

4. Testing in PowerShell and cmd

Open PowerShell or CMD, enter the folder where there is a C/C++ file, compile and run: gcc/g++ MinGW Windows 7 gcc/g++ MinGW Windows 8

In VS Code it is easier to use: VS Code

To facilitate the opening of PowerShell in VS Code you can install this extension.

If you wish, you can choose to follow this tutorial to install with MSYS2, however I find it messier, MSYS2 creates a bunch of shortcuts.

See too:

Create Games for Windows, Linux and Web with Raylib C/C++

windows gcc cpp clanguage