How to Install MinGW GCC/G++ Compiler on Windows 7, 10 or 11

Ghost Together
5 min readNov 3, 2022

--

GCC and G++ compilers are used to execute C & C++ code in Windows on command line, or to help run C and C++ from Visual Studio Code or IntelliJ IDE

#windows #10 #11 #MinGW #GCC #G++ #Installation #cmd.exe

Learning to code from scratch? 👇

Please Subscribe To My Coding Channel on YouTube.

(Publishing new tutorials almost daily.)

You’re here because you need to install MinGW (GCC and G++ builders) to compile C and C++ programs from command line (cmd.exe or Bash) on your system.

Perhaps you are looking to compile C and C++ in Visual Studio Code. And that means you still need to install MinGW with GCC and G++ tools for running your C-language programs.

Here’s setup instructions for installing MinGW on your Windows-based system. This is the video you want to watch, if you need to install GCC and G++ compiler on a PC:

How to install MinGW GCC G++ on Windows 10

How to install MinGW on windows 10 or 11

In this video you will learn how to:

  1. 00:00 How to Install MinGW on Windows 10
  2. 00:17 Downloading MinGW from SourceForge (not the official site)
  3. 00:50 Install MinGW
  4. 01:19 How to fix There is no script engine for file extension .js error — Just click OK
  5. 01:29 Right click on every checkbox and select “Mark For Installation” option
  6. 01:54 Click Installation Option on Drop Down Menu and click “Apply Changes”
  7. 02:18 Go to your File Explorer and locate C:\MinGW\bin folder, and copy its address
  8. 02:41 Go to Start button and type Environment Variables
  9. 02:58 Add C:\MinGW\bin to PATH under System Variables
  10. 03:34 Check if MinGW was installed and its version

How To Install MinGW on Windows

This article is based on the video above. So just go ahead and watch it.

Hey guys, in this Windows installation tutorial, I’ll show you How To install MinGW Compiler on Windows 10 or 11. (The same process applies to Windows 7 as well.)

Google is your best friend for finding correct MinGW installation files!

Type mingw download and locate this MinGW Source Forge link (usually second link, after the first search result on Google.)

(You don’t want to navigate to official site, as it will send you in circles to the Source Forge download site anyway.)

Locate this page and wait for file to download.

Click on the downloaded MinGW file to start installation process:

Right click on every single checkbox on the list, and select Mark for Installation.

How to add MinGW to my PATH System Variable in Windows’ Environment Variables

Now in order for our MinGW to become available for execition system-wide (from any location on the hard drive with the command line, not just from where it was installed,) we need to add the path to where MinGW was installed to Environment Variables.

Open your MinGW installation location with File Explorer.

Copy hard drive location where you installed MinGW in File Explorer, directly from the address bar (make sure to also include /bin folder as shown in following example):

In my case it was C:\MinGW\bin (I changed it from default location that used to be Program Files by default)

Now to open Environment Variables window, go to Start button and simply start typing Environment Variables.

Then, either hit Enter, or click on Open button.

Go to Environment Variables button in the first window that shows up.

Then on next screen locate PATH variable in the second box below under System Variables:

Click Edit button.

Click Add button and type C:\MinGW\bin and save that variable.

Click Ok 3 times as you exist Environment Variables windows to confirm changes.

How to find out which version of MinGW I have installed on my computer?

And finally…just to make sure you have MinGW successfully installed.

Go to Start button, type cmd.exe and hit Enter or click Open button.

In cmd.exe command prompt, enter the command g++ — version.

Now that your MinGW binaries path was added to Environment Variables, you should be able to run this command from anywhere on your hard drive. Not just when you change directory to C:\MinGW\bin on the command line.

And if that’s the case, you’ve successfully installed MinGW on your Windows OS.

This is also exactly what will allow you to compile C and C++ from IDEs like Microsoft’s Visual Studio Code and JetBrains IntelliJ. Good luck out there!

If errors show up and you don’t see the screen from example above, make sure you properly added it to PATH. Also check if you can run it from C:\MinGW\bin directory. If you still get errors, something is terribly wrong.

Please share this article if you found it helpful.

One Last Thing! Are You Learning To Code?

Learning to code from scratch? 👇

Please Subscribe To My Coding Channel on YouTube.

(Publishing new tutorials almost daily.)

--

--

Ghost Together

Ghost Together @ https://semicolon.dev is an alternative to Twitter. Sign up to meet other makers of things.