Have you ever wanted to develop your C++ applications on Windows 10 without Microsoft Visual Studio IDE ? If that’s the case, then you’re in the right place.

In this tutorial, you will learn how to install a C++ compiler on your Windows 10 machine. By the end of this guide, you’ll be able to use the g++ command in Windows command line.

Download and Install MinGW

MinGW is a free and open source software development environment to create Windows applications. It includes a port of the GNU Compiler Collection (GCC) and allows anyone to download and compile code in several languages (C, C++, ADA, Fortran and Java) for native Windows using only free software.

Now go ahead and download MinGW and install it, the first window that will appear will look something like this:

Click “Install”, the next window will ask you to customize some options, including the path in which you want to install MinGW. I encourage you to keep the defaults, like so:

After you hit “Continue”, MinGW should start downloading:

After few seconds, the download process should be finished:

Installing Libraries

Once you hit “Continue” in the last window, MinGW Installation Manager window will appear, and we need to use it to install the libraries we actually want.

In order to select the libraries, you can either right click or click on the checkbox and select “Mark for Installation”, as shown in the following figure:

Now, apply this for the following packages (under Basic Setup):

  • mingw32-base
  • mingw-developer-toolkit
  • mingw32-gcc-g++
  • msys-base

After you’ve done that, go to “All Packages” in the upper left of the window and search for mingw32-lipdcurses and select it for installation as well.

Once you selected the necessary libraries, then you need to apply the changes, you can do that by clicking on the “Installation” menu and selecting “Apply Changes”, like so:

A new window will appear, just hit “Apply” and it’ll start downloading the libraries:

Give it a few seconds to complete, and then click “Close” once it’s finished.

Now the GNU C++ compiler should be installed on our Windows 10 machine, but we need to add it to the environment variables so that we can access it via the command line.

Setting Environment Variables

The quickest way to access environment variables on Windows 10 is to hit CTRL+S on your keyboard for the search bar, and then just write “env” or something, it’ll appear like shown in the following image:

Hit Enter, System Properties window will appear, click on “Environment Variables” button:

Under System variables, go on and search for “Path” variable, once you find it, click on “Edit” Button:

Finally, click on the “New” Button on the Edit environment variable window, and add these two directories:

  • C:\MinGW\bin
  • C:\MinGW\msys\1.0\bin

This will only work if you keep the path defaults in the installation process as shown previously, if you changed the path to another partition, make sure to change it here as well:

Once you’ve done that, click on “OK” on all opened windows and everything should be good to go.

To verify that C++ compiler is indeed installed on our machine, open up a new command line prompt and write g++, as shown in the following image:

If you have that error, then it’s properly installed!


Congratulations, if you follow this guide, you’ll be able to install C++ compiler on Windows 10 successfully.

Happy Installing ♥