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.
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 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.
Automated Installer
Download the latest MinGW-5.x.x.exe installer from sourceforge.net and run the installer. When prompted to choose which package you wish, if unsure or if you have never used MinGW before, we recommend choosing the "current" package (the default option). You will then be able to choose which components you wish to install:
- MinGW base tools: This required component is composed of binutils, the C compiler, the runtime and platform API.
- ... compiler: This component install a compiler for the programming language specified in the label of the component. Usually, you will at least want to also install the C++ compiler.
- MinGW make: This component installs make, a program capable of interpreting Makefiles. This component is highly recommended as many IDE's require this functionality.
When choosing the "Destination Folder" for the installation, please consider not installing MinGW in a path that contains spaces unless you have read the installation notes above and are aware of possible problems.
The installer will then download and install the components selected.
Manual Installation
As an alternative to the automated installer, you may install MinGW by manually downloading and uncompressing individual components.
Download at least the following (or newer) packages from the MinGW download page:
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:
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 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 will also need a program that can extract tar.gz files, such as the GUI-based WinZip or 7-Zip, or the command-line tar and gzip tools. Command line tools are provided by MSYS, or Google for 'gnu+tools+win32' to find alternatives. The GnuWin32 project provides Windows-native builds of tar and gzip CLI tools.
Create a directory (e.g. C:\MinGW), download all packages to C:\MinGW, for each package execute gunzip/untar package, and add C:\MinGW\bin; to your PATH environment variable:
Example
C:\Documents and Settings\Owner> cd /d c:\ C:\> md MinGW C:\> cd MinGW
Download all packages to C:\MinGW
C:\MinGW> gzip -d -c binutils-2.17.50-20060824-1.tar.gz | tar x C:\MinGW> gzip -d -c gcc-core-3.4.5-20060117-3.tar.gz | tar x C:\MinGW> gzip -d -c mingwrt-3.15.1-mingw32-dev.tar.gz | tar x C:\MinGW> gzip -d -c w32api-3.12-mingw32-dev.tar.gz | tar x 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.3.3, C:\MinGW-3.4.2 and C:\MinGW-3.4.5. 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.
Re: Getting Started
which environment is used to let GCC find the include and library in? There are 2 reasons I do this:
1. I do not like to install some c-lib to my MINGW directory, because I don't use it frequently. I can delete them easily - is there any other method do something like "make uninstall"?
2. I do like to install 3rd-part lib into /local, which is h:\mingw\msys\local, to make my MINGW clean and small
and on windows, I have tried 2 types(let's think "lib" is used to search libaray files)
[code, which is added in a batch file ]
set lib=h:\mingw\msys\local\lib;%lib%
set include=h:\mingw\msys\local\include;%include%
[/code]
or
[code, which is added into profile or typed in msys]
set LIB=/h/mingw/msys/local/lib:$LIB
set INCLUDE=/h/mingw/msys/local/include:$INCLUDE
[/code]
but none works. I have always to add
[code]
-I/h/mingw/msys/local/include -L/h/mingw/msys/local/lib
[/code]
to the gcc command-line by hand. That make me tired.
So is there any hints to set the environment automatically everytime to save my time?
thanx