Installing Minimum GNU for Windows (MinGW)


I am currently working for the first time with the programming language C++ in an enterprise environment. Therefore I will also privately focus more on C++ and related tools in the future. For that reason I want to write some blog articles in the future, which should serve me (and maybe you - the reader) as notes.

In this article I describe the installation of Minimum GNU for Windows (MinGW). In following articles I will describe how-to use NetBeans IDE for C++ software development and how-to build and use popular C++ libraries, such as Boost.

So, let’s start with the installation of MinGW.

MinGW, a contraction of “Minimalist GNU for Windows”, is a minimalist development environment for native Microsoft Windows applications.

Note: Alternatives for C++ development under a Microsoft Windows operating system are Cygwin and Microsoft Visual C++. Cygwin is an attempt to create a complete UNIX/POSIX environment on Microsoft Windows, whereas Visual C++ is a compiler for Microsoft Windows. MinGW contains MSYS, which is also a UNIX/POSIX environment for Windows. But in contrast to Cygwin, MSYS is more compact. Nowadays all the MSYS components can be installed via MinGW.

  1. Download the “MinGW Installation Manager Setup Tool” (mingw-get-setup.exe) from the official download URL. The current version is 0.6.2-beta-20131004-1.
  2. Run mingw-get-setup.exe.
MinGW Installation Manager Setup Tool
  1. Select the button Install. The dialog Step 1: Specify Installation Preferences is opened.
    • Enter C:\dev\MinGW (or any other valid directory name in the text input Installation Directory.
    • Check all checkboxes.
MinGW Installation Manager Setup Tool Step 1
  1. Select the button Continue. After the installation is finished, the window MinGW Installation Manager is displayed.
    • Select the list item Basic Setup in the listbox on the left.
    • Check the following checkboxes in the listbox on the right:
      • Package mingw-developer-toolkit; Class bin
      • Package mingw32-base; Class bin
      • Package mingw32-gcc-g++; Class bin
      • Package mingw32-gcc-g++; Class dev
      • Package msys-base; Class bin
MinGW Installation Manager
  1. Select the item Apply Changes below Installation in the menu bar. The selected packages are installed.
  2. Add the path of the MinGW and MSYS bin directories to the user environmental variable PATH. I recommend to define and/or modify the following two user environmental variables:
    • MINGW_HOME with the value C:\dev\MinGW.
    • Append %MINGW_HOME%\msys\1.0\bin;%MINGW_HOME%\bin to PATH.
  3. Log-off from Microsoft Windows and log-in again.

And that’s it. We have successfully installed MinGW. Now we can test compilation, linking and running of a C++ application. Of course, we will do that by implementing Hello World (what else?).

  1. Create a new file with the following content:

     #include <iostream>
     using std::cout;
     using std::endl;
     int main(int argc, char** argv) {
       cout << "hello, world" << endl;
       return 0;
  2. Open a command prompt (cmd.exe).
  3. Compile, assemble and link the source file with with g++ (GCC), by running the following command:

     g++ -o hello_world.exe
  4. Run the executable:


The following should be printed to the standard output:

hello, world

Impressive. We have successfully implemented our first C++ application with MinGW.

Prepare for some more C++ stuff in the future!