How to Install MinGW GCC/G++ Compiler for Windows

Install MinGW GCC/G++ Compiler for Windows that will provide tickets to the functionality of the Microsoft C runtime and some language runtimes. MinGW is a native Windows port of the GNU GCC, with freely distributable import libraries and header files for building native Windows applications.

In this article, I will guide you on setting up your computer to use the C++ language. If you are trying to do C++ programming, you first have to set up your computer’s environment according to it.

I am installing it on windows 10 but the process of installing the MinGW GCC/G++ compiler is the same for almost all machines.

Must read:

Introduction to Standard C++ : In a Nutshell

MinGW GCC/G++

mingw-w64
MinGW-w64

MinGW – Minimalist GNU for Windows

MinGW compilers provide tickets to the functionality of the Microsoft C runtime and some language runtimes. MinGW is a Minimalist GNU for Windows for free.

A native Windows port of the GNU Compiler Collection (GCC). This project is in the process of repositioning to osdn.net/projects/mingw.

MinGW is a native Windows port of the GNU Compiler Collection (GCC), with freely distributable import libraries and header files for building native Windows applications.

Download MinGW GCC/G++ Compiler

At first, just open your browser and type MinGW and press enter to search. In the next step open the first search result which is from the website www.mingw-w64.org or sourceforge.net/projects/mingw

If you go through the mingw-w64.org website. After landing on the homepage see in your left-hand sidebar where search for downloads. After clicking on downloads you will be redirected to the second website sourceforge.net

Because MinGW files are hosted on the source forge website.

Then simply click on download which will give the mingw-get-setup.exe with a size of 86KB file.

Install MinGW GCC/G++ Compiler

The mingw-get-setup.exe is a simple installer file that will say you to do simple clicks for your requirement and your computer machine will be ready to use for C runtime( C++ Programming).

Follow these steps to install g++ on the machine –

  • double click on the downloaded MinGW file and click next.
  • now the directory selection where to install the MinGW, I will prefer using the default C:\MinGW folder and click continue.
  • Then it will Download and Set up the MinGW installation manager as it will download some packages itself.
  • wait until the download finishes, after completion of downloading click continue.

MinGW Installation Manager

Now tick mark on your preferred choices

  • mingw-developer-tools
  • mingw32-base
  • mngw32-gcc-g++
  • mingw32-gcc-objc
  • mysys-base

Tick above 5 boxes and navigate installation > apply changes

now sit back it will install all these packages and will take some time to install.

when all mingw packages you have chosen are installed you will see a message

All changes were applied successfully. You may now close the dialogue.

Setting up the environment for C++

  • Go to the C:\ directory and navigate to mingw folder and inside it open bin folder
  • Copy path of mingw bin folder
  • Right-click on this PC and click Advanced system setting > environment variables
  • Inside the system variables click path and choose the below option edit
  • Simply add the copied path to it. It’s done, click OK.

Checking if the mingw is installed or not

Open the command prompt and type g++ and hit enter

C:\Users\Piotech INDIA>g++
g++: fatal error: no input files
compilation terminated.

this means the g++ is installed but no input files.

Again in the command prompt type g++ –version and hit enter

C:\Users\Piotech INDIA>g++ –version
g++ (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

After Installing MinGW

The next step after installing minGW for windows is to write code so we can do this with the below options

  • You can write code inside a text document and manage or compile it using the windows command prompt. After writing code inside the text file save it as filename.cpp and after compiling you will get your filename.exe file.
    That can be run/execute simply with windows
  • Or you can use some IDEs to write code eg. Visual Studio Code
    with IDEs and their various plugins you can write code easy as some functions are like tags autocomplete, variable suggestions, error showing with console

Must read:

Introduction to Standard C++ : In a Nutshell

It’s done. Now your machine is ready to compile your c++ program and run it.

Thank You

Share your love
Lamba Pankaj
Lamba Pankaj
Articles: 12

Leave a Reply

Your email address will not be published. Required fields are marked *

I'm not a robot *Time limit exceeded. Please complete the captcha once again.

Website Design Trends in 2022 5 Movies that Programmers Should Watch Best Search Engine for Developers – You.com 06 Free Website Hosting Providers for Developers You should Know Learn Programming while playing games