What MinGW Is

I recommend that anyone who is learning Standard C++ and who uses Windows for a primary development environment should use two compilers: the most modern version of Microsoft Visual C++ (currently 2013) and the most modern version of GCC, the GNU Compiler Collection. Using two compilers that conform closely to the Standard subjects your code to more strenuous trials than using a single compiler would.

MinGW is a port of GCC to Windows. It is free of charge and simple to use (well, as simple as toolchains ever get). It produces standalone Windows executables which may be distributed in any manner. MinGW's official website mingw-w64.sourceforge.net provides various builds, but I maintain my own distro because I demand complete control. (It's a long story, but mingw-w64 forked from mingw.org. Although my distro was based on mingw.org for many years, I now consider mingw-w64 to be the one true MinGW.)

Please note that I did not write any of the components of my distro. I simply compiled them and packaged them together.

How To Install

First, run the self-extracting archive. It'll ask you for a directory:

Just wait until it's done. I've gone to great lengths to make the distro as small as possible, but Boost and git are very large, so there's a lot of stuff to extract.

Third, open the root of the distro, which is C:\MinGW if you followed my recommendation. There, you'll find two batch files and README_STL.txt . Inside the readme, there are copies of this webpage's Contents and History sections in case you forget which version of the distro you have or what it contains. There are also the following usage instructions:

Option A: In an existing Command Prompt, run set_distro_paths.bat to add the
distro to that Command Prompt's PATH.
Option B: Create a shortcut to open_distro_window.bat, which will open a new
Command Prompt with the distro on its PATH. You may move the shortcut
to another directory (or the Desktop), and you may modify the
shortcut's properties to start in a directory of your choice (for
example, C:\Temp).
Leave set_distro_paths.bat and open_distro_window.bat in the root of the distro.
Neither Option A nor Option B permanently modifies your system.

Finally, type g++ --version in your Command Prompt and hit Enter. You should see something like this:

C:\Temp>g++ --version
g++ (GCC) 4.9.2
Copyright (C) 2014 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.
C:\Temp>

If you see something like that, then you have successfully installed MinGW.

Notes:

My distro is directory-independent, so you can put it in a directory other than C:\MinGW . If you feel like playing with fire, I even tested paths-with-spaces when I wrote my batch files, but I can't guarantee that all of the distro's components will be similarly tolerant.

You should not modify anything in the MinGW directory unless you know what you're doing. In particular, do not compile your programs there!

How To Upgrade

Simply replace C:\MinGW .

I shouldn't need to warn you about extracting a newer version of the distro into a directory which already contains an older version. That would create a mess.

How To Uninstall

Simply delete C:\MinGW .

How To Build Your Own Distro

components-12.2.7z (46.3 MB) : My distro is formed by extracting these binary components into a single directory, then adding the batch files and readme. These binary components are useful if you want to create a subset of my distro, or if you want to update a few components without having to rebuild everything.

Building the components from scratch requires a few things. First, you'll need their sources, which you can obtain from their official websites. Second, you'll need my build scripts and patches, which are in the scripts-VERSION subdirectory in the root of the distro. Finally, the build scripts must be run in MSYS:

msys-10.4.7z (2.7 MB) : Run extract.bat . This extracts MSYS's binary components, obtained from mingw.org, without running an installer. (Do not follow mingw.org's instructions, or you'll end up with an environment that's different from mine, and then things will explode and you'll be sad. Building the distro is extremely difficult and you should not make it harder than it already is.)

Important notes:

The build scripts assume that they can use C:\Temp\gcc as a working directory and that they do not live directly within it. They also assume that they live next to the sources. I generally put both of them into C:\Temp\gcc\sources-VERSION .

I highly recommend that you execute each build script by hand before attempting to run it in one shot.

msys.txt in the scripts-VERSION subdirectory explains how to recreate my MSYS package.