Notes on installing MinGW (minimal Gnu for Windows)

March 11, 2014

The two primary steps are

My steps, on a 32-bit system running Windows XP:

1. Go to mingw.org and download mingw-get-setup.exe. Run and install it.

2. From the installer, check the following for installation:

(In class I said to install the mingw-developer-toolkit; this is wrong.) Select Installation => Apply Changes. Installation takes a long time. (I did not write down which version I installed. It was whatever the mingw-get-setup chose for me.)

3. Add the c:\mingw\bin directory to your PATH. This allows eclipse to find the g++ binary; it also allows the binary to be found from the command line.

Go to control panel => system => advanced => environment variables (the exact names will depend on your version of windows). Edit the entry for PATH (or Path) (only part of the original PATH is shown here):

    %SystemRoot%\system32;%SystemRoot%;c:\mingw\bin

Don't forget the semicolon. The new portion is ;c:\mingw\bin

4. At this point, if you open a new cmd window and just type g++ at the command prompt, you should get

    g++: fatal error: no input files; compilation terminated.

If g++ is not found, you get:

    g++: is not recognized as an internal or external command, operable program or batch file.

At this point you can download a simple hello.cpp program to your home directory, navigate to that directory from within a cmd window, and type

    g++ hello.cpp

This should create a file a.exe, which you can run by typing "a.exe" or just "a".

5. Install the C++ version of eclipse from http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/keplersr2. This is version Kepler-SR2.

6. At this point, the c++ version of eclipse worked the first time! I did choose New => C++ Project => MinGW gcc

Disclaimer: this is only sort of true. I downloaded eclipse, but had a very hard time unzipping it: it would appear to unzip, but not in fact correctly. I finally had to install 7zip. After that I had no trouble. This is probably because I am running Windows XP. Before eclipse unzipped properly, it would tell me "the eclipse executable was unable to locate its companion shared library".