This page will guide you through a typical, one size fits all, installation of MinGW. If you are new to MinGW, you may wish to refer to the MinGW page to learn which packages are required, and which tools are used to perform which tasks. For more advanced installation instructions, refer to HOWTO Install the MinGW (GCC) Compiler Suite. There is also some introductory information for users who are new to MinGW.
MinGW Installation Notes
MinGW may have problems with paths containing spaces, and if not, usually other programs used with MinGW will experience problems with such paths. Thus, we strongly recommend that you do not install MinGW in any location with spaces in the path name reference; i.e. you should avoid installing into any subdirectory of "Program Files" or "My Documents", or the like.
No version numbering convention exists for MinGW as a whole. Each package has its own version number, and the installer version number does not necessarily reflect the version number of any individual package which it installs.
The mingw-get installer currently installs only GCC 3. You will get GCC 3 using this method. If you want to install the latest GCC release, use the Manual Installation method below.
Add C:\MinGW\bin; to the PATH environment variable by opening the System control panel, going to the Advanced tab, and clicking the Environment Variables button. If you currently have a Command Prompt window open, it will not recognize the change to the environment variables; you will need to open a new Command Prompt window to get the new PATH.
At the Command Prompt, type the command
mingw-get install mingwrt w32api binutils gcc
to download and install the C compiler.Additionally, you can specify any or all of the following additional packages:
- g++ (C++ compiler)
- g77 (Fortran 77 compiler)
- ada (Ada compiler)
- java (Java compiler)
- objc (Objective-C compiler)
- mingw32-make (GNU make)
- gdb (GNU debugger)
For example, the command
mingw-get install mingwrt w32api binutils gcc g++ mingw32-make
will install the C compiler, C++ compiler, and make utility.You can install more additional packages at any time. For example, the command
mingw-get install g77 gdb
will add the Fortran 77 compiler and debugger to the existing installation.
The mingw-get release notes contain more detailed information about the configuration and use of the mingw-get installer. GCC documentation, make documentation, and GDB documentation are available online.
As an alternative to the automated installer, you may install MinGW by manually downloading and extracting individual components. Please refer to the release notes for detailed notes, including known issues.
Before proceeding, you are encouraged to also consult the release notes for each individual package; links to these will be found adjacent to each package file entry, on the MinGW Download Page.
Download at least the following (or newer) packages from the MinGW Download Page; where two or more component packages are indicated, you need both / all of them. (Note that the package links provided here refer to current releases at the time of writing; these links may not necessarily be updated immediately, when new releases become available):
- mingw-runtime (dev and dll)
- Required runtime libraries for GCC:
- gcc-core (bin and dll)
These are the minimum requirements for a working MinGW GCC toolchain for C.
Optionally you may want to add any of the following additional languages; (for each which you choose to install, you need both the bin and the dll component packages):
- gcc-g++ (bin and dll) for C++
- gcc-objc (bin and dll) for Objective C
- gcc-gfortran (bin and dll) for Fortran 90/95
- gcc-java (not yet available) for Java
- gcc-ada (bin and dll) for Ada
Note that the GCC versions of these files must match the GCC version of the gcc-core installed.
Optionally you may want to add any of the following additional utilities:
- mingw-gdb and libexpat for debugger
- mingw32-make for make
- mingw-utils for MinGW Utilities
- MSYS for Unix-style commands and shell (see the MSYS page for installation instructions)
- msysDTK for Unix-style developer toolkit
You may also want the following additional features:
You will also need a program that can extract .tar.gz and .tar.lzma files, such as 7-Zip or command-line tar, gzip, and lzma tools. A basic standalone tar program bsdtar that includes gz and lzma support is available from the MinGW project.
Create a directory (e.g. C:\MinGW), download all packages to C:\MinGW, extract the files from each package, and add C:\MinGW\bin; to your PATH environment variable:
C:\Documents and Settings\Owner>cd /d c:\ C:\>md MinGW C:\>cd MinGW
Download all packages to C:\MinGW
C:\MinGW>7z x binutils-2.20.51-1-mingw32-bin.tar.lzma C:\MinGW>7z x binutils-2.20.51-1-mingw32-bin.tar C:\MinGW>7z x mingwrt-3.18-mingw32-dev.tar.gz C:\MinGW>7z x mingwrt-3.18-mingw32-dev.tar C:\MinGW>7z x mingwrt-3.18-mingw32-dll.tar.gz C:\MinGW>7z x mingwrt-3.18-mingw32-dll.tar C:\MinGW>7z x w32api-3.14-mingw32-dev.tar.gz C:\MinGW>7z x w32api-3.14-mingw32-dev.tar C:\MinGW>7z x mpc-0.8.1-1-mingw32-dev.tar.lzma C:\MinGW>7z x mpc-0.8.1-1-mingw32-dev.tar C:\MinGW>7z x libmpc-0.8.1-1-mingw32-dll-2.tar.lzma C:\MinGW>7z x libmpc-0.8.1-1-mingw32-dll-2.tar C:\MinGW>7z x mpfr-2.4.1-1-mingw32-dev.tar.lzma C:\MinGW>7z x mpfr-2.4.1-1-mingw32-dev.tar C:\MinGW>7z x libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma C:\MinGW>7z x libmpfr-2.4.1-1-mingw32-dll-1.tar C:\MinGW>7z x gmp-5.0.1-1-mingw32-dev.tar.lzma C:\MinGW>7z x gmp-5.0.1-1-mingw32-dev.tar C:\MinGW>7z x libgmp-5.0.1-1-mingw32-dll-10.tar.lzma C:\MinGW>7z x libgmp-5.0.1-1-mingw32-dll-10.tar C:\MinGW>7z x pthreads-w32-2.8.0-3-mingw32-dev.tar.lzma C:\MinGW>7z x pthreads-w32-2.8.0-3-mingw32-dev.tar C:\MinGW>7z x libgomp-4.5.0-1-mingw32-dll-1.tar.lzma C:\MinGW>7z x libgomp-4.5.0-1-mingw32-dll-1.tar C:\MinGW>7z x libssp-4.5.0-1-mingw32-dll-0.tar.lzma C:\MinGW>7z x libssp-4.5.0-1-mingw32-dll-0.tar C:\MinGW>7z x gcc-core-4.5.0-1-mingw32-bin.tar.lzma C:\MinGW>7z x gcc-core-4.5.0-1-mingw32-bin.tar C:\MinGW>7z x libgcc-4.5.0-1-mingw32-dll-1.tar.lzma C:\MinGW>7z x libgcc-4.5.0-1-mingw32-dll-1.tar C:\MinGW>set path=C:\MinGW\bin;%path%
The whole C:\MinGW subtree is fully relocatable which means there can be several different versions of the MinGW toolchain installed in parallel, e.g. in directories C:\MinGW-3.4.5 and C:\MinGW-4.5.0. Switching between these is merely a matter of renaming directories, assuming C:\MinGW\bin; has been added to the path. You can permanently add C:\MinGW\bin; to the path by opening the System control panel, going to the Advanced tab, and clicking the Environment Variables button.
Updating single packages (e.g. when there is a new version of the w32api) can be done by copying the new package to C:\MinGW and unpacking as above to overwrite the older version. This manual update also works with an initial automated install.