Revision of Getting Started from 2010, April 14 - 14:57

Printer-friendly version

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.

New to MinGW? What you should first know

Are you new to Mingw? You know nothing about Unix? What is MSYS?
These are common questions for anyone starting out in the programming world. Reading this may help you.

Probably you reached here because you want a good and free compiler for Microsoft Windows.
And yes, here you have it. Don't get disturbed by so many technical subjects. By now, you don't need them.

Mingw uses the great GCC (GNU Compiler Collection). GCC was born in Unix world. Using it in Windows "as is" is not possible, because these Operating Systems (OS) differ in the way they manage data internally and externally. So many files from GCC must be adapted to be used in Windows. And this is what Mingw is for. Many thanks to all the people who donate this effort. Other approach is that from Cygwin: emulate Unix style. Cygwin emulates a POSIX layer and provides its own runtime libraries licensed as GNU GPL instead of working directly with runtime libraries already available on Windows or with less restrictive (non-GPL) licensing.

Download and extract

Because there are many things to use (compiler, linker, utils, API, etc.) you need to download several files:

gcc the compiler
mingwrt the Mingw Runtime system
w32api the Windows Application Programming Interface
binutils linker, profiling, windows resources, etc.
make which gathers all "things to do" to achieve your program
gdb a great debugger to look inside your app while it is running

The complete name for each file to download includes its version.
You can also download the MinGW-xxx.exe file, and let it download the rest, but probably it doesn't download the last version of each file. The new mingw-get intaller will improve this situation when it becomes available.

Files are compressed in Unix style: .tar.gz

Use an un-zip app (7-Zip is really good: and extract all of it to your desired directory, usually c:\mingw. Caution: never install MinGW into any directory which includes spaces in its absolute path name.

Some sub-dirs are created. Some files may overwrite other ones. Usually they are license repeated files. No problem: just choose the newer over the older.

The basis

If you just learned to write some code and push the "run" icon you may get lost with so many new concepts. Well. Here's a bit of explanation:

You develop your app writing code and splitting it in some files. You also create icons. And perhaps new cursors.

  • Each file you create (or re-use) must be analysed, understood, translated to machine-code and even optimized. That's work for the compiler.
  • Your icons and cursors will be managed by the windows resources manager (winres.exe).
  • All "translated units" (compiled) must be joined. Time for the linker.
  • During execution, any app must communicate with OS (which is what really uses CPU, memory and other devices) using the Runtime system.
  • To get the OS utilities (say a control, a dialogue, http services, etc.) API must be used.

You surely need special files with functions made by others: libraries. Typically these are the .dll files your app loads at runtime ("dynamic loading" or "shared linking"). But you can also make them part of your .exe file ("static linking"). You can find these special files (.a) in \lib dir.

By now (April 2010) your app will need the file mingwm10.dll. This file is for multi-threading and will not be statically linked into your .exe file. Multi-threading is an expert way of getting more from the CPU. It simulates (or uses) several cores working simultaneously.

All of this building process can be described in a file (say mybuild.file). And you can call it using mingw32-make.exe.

To run your app in a way you can pause it and look at some variables of your code (debugging), use gdb.

If you want to know where your app spends more time (profiling), use gprof. If you want to be alerted as to where to find an error in your code when a program you compiled with MinGW crashes, use a Just in Time debugger such as DrMingw.

Most of this utilities have "parameters" or "flags" or "command switches" when you invoke them. For example, you can ask gcc to generate code optimized for a special CPU, or tell it where to look for (include) other files. You can read gcc/cpp/gprof/etc. documentation on the web (i.e.

You call make (or each component, one by one) typing it in a command-box.

I'm sure you are asking "Good. But what about pushing the run button?"

For that you need an IDE (Integrated Development Environment). MinGW doesn't incorporate one. You can find many on the web. There are IDE's that include also compilers (as MS Visual Studio).

I recommend Code::Blocks ( It's good and free. And it's built with MinGW :) If you also install MinGW, C::B can use it automagically, debugging included.

What is MSYS?

It is a Unix-like command line shell.
Unix has some utilities (configure, sed, grep, etc.) you can use in this "box".
Some people develop their apps preparing a make-file that only works well if it's invoked from a Unix shell.

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.

Automated Installer

Note: The automated installer is now considered deprecated, and is currently unmaintained; it will not install GCC 4. You will get GCC 3 using this method. If you want to install the latest GCC release, use the Manual Installation method below.

A new automated installer currently in development, mingw-get, is planned to automatically install GCC 4. It will have both a graphical user interface (GUI) and a command line interface (CLI), either of which can be used to install all packages in GCC 4.

Download the latest MinGW-5.x.x.exe installer from and run it. 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 libraries and platform API.
... compiler: These components each 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 for those who don't want to also install MSYS (why not?); many IDE's require this functionality.

When choosing the "Destination Folder" for the installation, please do not choose any path that contains spaces in its absolute name, unless you have read the installation notes above and are willing to accept the possible consequences; if you are in any doubt, accept the default.

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.

Before proceeding, you are encouraged to 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):

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
  • gcc-java (bin and dll) 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:

You will also need a program that can extract .tar.gz files, (or in some cases .tar.bz2 and .tar.lzma and .tar.xz files), such as the GUI-based WinZip (not recommended), or 7-Zip, or the command-line tar, gzip and lzma and xz tools. Command line tools are provided by MSYS (recommended), or Google for 'gnu+tools+win32' to find some alternatives. The GnuWin32 project provides Windows-native builds of tar and gzip CLI tools. Mingw supplies a native and msys version of xz in its file archives. 7zip supports decompression of several formats including lzma and xz as well as tar and bz2 and zip. 7zip provides a GUI interface, but there's also a command line tool, 7za, found at the 7zip site. Syntax for using 7za is not exactly the same as tar, gzip, xz or some other standard command line utilities.

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:


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.20.1-2-mingw32-bin.tar.gz | tar x
C:\MinGW> gzip -d -c mingwrt-3.18-mingw32-dev.tar.gz | tar x
C:\MinGW> gzip -d -c mingwrt-3.18-mingw32-dll.tar.gz | tar x
C:\MinGW> gzip -d -c w32api-3.14-mingw32-dev.tar.gz | tar x
C:\MinGW> gzip -d -c gmp-4.2.4-mingw32-dll.tar.gz | tar x
C:\MinGW> lzma -d -c libiconv-1.13.1-1-mingw32-dll-2.tar.lzma | tar x
C:\MinGW> gzip -d -c mpfr-2.4.1-mingw32-dll.tar.gz | tar x
C:\MinGW> gzip -d -c pthreads-w32-2.8.0-mingw32-dll.tar.gz | tar x
C:\MinGW> gzip -d -c gcc-core-4.4.0-mingw32-bin.tar.gz | tar x
C:\MinGW> gzip -d -c gcc-core-4.4.0-mingw32-dll.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.4.5 and C:\MinGW-4.4.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.

Manual Installation of GCC 4.5

The following are instructions for installing GCC 4.5 where they differ from GCC 4.4. This version of GCC has not yet been released and is only for testing purposes. Please refer to the release notes for detailed notes, including known issues.

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.

You may also want the following additional features:

Optionally you may want to add any of the additional utilities that are available for GCC 4.4. Some information on Other Libraries and Tools to use with MinGW is also available.

Re: Getting Started


Re: Getting Started

I was trying to install the mingw in the order of files that is above (binutils, mingw-runtime, w32api...) and when I was trying to install the gcc core, appeared a message asking me about overwrite a file called "libiberty" (I don't remember in this moment the extension). What libiberty is the correct to leave, the first or the libiberty that is in the gcc core?

Re: Getting Started

earnie's picture

It doesn't matter which one you keep. The libiberty.a file is an artifact of both binutils and gcc with the unfortunate side affect of the file being installed with the ``make install command which is the real error here. The two packages should never install the file but the way the iberty library is packaged within both with a separate ``make install' command allows this to happen. The iberty library is packaged with each because of both the GPL and the GNU Coding Standard.

MinGW 5.1.6 Error: mismatched long filename


MinGW-5.1.6.exe, binutils-2.20-1-mingw32-bin.tar.gz, mingwrt-3.16-mingw32-dev.tar.gz, mingwrt-3.16-mingw32-dll.tar.gz, w32api-3.14-mingw32-dev.tar.gz, make-3.81-20090914-mingw32-bin.tar.gz from, and

gcc-core-4.4.2.tar.gz, gcc-g++-4.4.2.tar.gz, gcc-fortran-4.4.2.tar.gz, gcc-ada-4.4.2.tar.gz, gcc-java-4.4.2.tar.gz, gcc-objc-4.4.2.tar.gz from mirror ftp

2)-----------modify mingw.ini like this:-------------


















3)-----------------------install mingw 5.1.6---------------------------

disconnect->run mingw.exe->"download and install"->"current"->"full"->c:\mingw

it start correctly but, there's always an error message while extracting gcc-g++-4.4.2.tar.gz :

Writing gcc-4.4.2/libstdc++-v3/testsuite/26_numerics/adjacent_difference/

tgz_extract: mismatched long filename

Error: Failure reading from tarball.

my OS: windowsxp sp3

file system: ntfs

Re: MinGW 5.1.6 Error: mismatched long filename

keith's picture

Please read the article again.

You cannot use MinGW-5.1.6.exe to install any version of GCC later than 3.4.5. Neither can you gerrymander it, to build from sources downloaded from any repository other than our own SF distribution; it requires the pre-built binary package files, which we provide.

What you are trying to do is both unsupported and impossible, with the deprecated installer package you are trying to use.

Re: Getting Started

I notice that someone has very helpfully updated this page according to information from the "release notes". Could someone add a link to the release notes on this page? That would also be very helpful. Also, does one need to install both the "bin" and "dll" versions of the packages, or just one of them? In either case, it would be very helpful to disambiguate the commas to either "and" or "or", or if punctuation is preferred, "&" or "/". Thanks!

Re: Getting Started

The release note for MinGW GCC 4.4.0 can be found here.

Re: Getting Started

After reading all the comments so I could complete the installation, thanks!

Re: Getting Started

very use full article thanks alot and thats so nice

Re: Getting Started


This may be a trivial problem but in spite of updating the path variable (c:\MinGW\bin), gcc/g77/etc. does not work from command line. It works fine in the c:\MinGW\bin directory as well as on my other computer. I am not sure what the problem could be. Any suggestions?

With kind regards,

Re: Getting Started


I just installed and had exactly the same problem.
It's not that obvious, you need to set the mount
point of the MinGW directory in the Msys environment.

as a start, just try coping /etc/fstab.sample to /etc/fstab and
restarting the msys..



Re: Getting Started

Hi guys.

Will mingw work on future versions of windows?

I'm upgrading to Vista in a short time and i want to know how much 'upgrading' will make me suffer.

My guess is that you guys at Mingw should develop a new version for Vista?

Or is it just the same? What about the Win32 Api? There are surely additions with newer versions of windows.



Re: Getting Started

keith's picture

I find it really insulting, when someone says "you guys should...".

This is an Open Source project, developed by volunteers in their spare time. You have no right to tell me what I should, or should not do with my spare time. Why should I, rather than you do that?

AFAIK, MinGW already does work with Vista, but why don't you just try it, and see; then contribute on the basis of your experience, either in the form of patches, or failing that, bug reports?

Re: Getting Started

Please include the gdb package in the automatic installer.

I need advice on how to install gdb manually. I have two download files:



I plan to use the .tar.gz2 download for the installation and your instructions for that seem clear enough. Is the patch file required for this installation? That is, do I need to apply the patch file to the extracted content from the .tar.gz2 archive or is the patch file only used with the src download?


Re: Getting Started

keith's picture

GDB is an entirely separate product from GCC. It is not a prerequisite for running GCC, as are the majority of other packages which are installed by MinGW-5.x, and hence it is not imperative that MinGW-5.x should install it. However, the same argument for exclusion could be applied, in the case of mingw32-make, which is included; conversely, the inclusion of mingw32-make sets a precedent for the possible inclusion of GDB. Ultimately, the decision on that is down to the package maintainer; since MinGW-5.x is currently unmaintained, don't expect it to happen any time soon.

mingw-get, when it eventually becomes available, will install any package -- and optionally all of them -- which is distributed by the MinGW Project.

I'm confused by your reference to gdb-6.8-mingw-3.tar.gz2, for there is no such thing as gz2 compression; it is either bz2 or gz. In this case, I assume you mean the binary release file gdb-6.8-mingw-3.tar.bz2, rather than the source tarball, gdb-6.8-mingw-3-src.tar.gz.

The gdb-6.8-mingw-3-patch file, to which you refer, (and by which I assume you mean gdb-6.8-mingw-3.patch), details the source code changes to mainline gdb-6.8 sources, which were applied to achieve this gdb-6.8-mingw-3 release candidate, (which strictly, should be called gdb-6.8-mingw32-3). They are of interest only to those integrating mingw32 support into mainline GDB; you do not need them, if your only interest is in deployment of gdb-6.8-mingw-3.tar.bz2. (It isn't immediately obvious if these patches have already been incorporated into the local sources, gdb-6.8-mingw-3-src.tar.gz -- I am not the maintainer of this package -- but the naming convention would suggest that they have).

Re: Getting Started

I agree it would be convenient to include gdb. how many programmers are there who want to install a compiler and don't want to also install the debugger?

at the least, it would be useful to just outline the basic steps to install gdb. I downloaded the same files as darrenleeweber and had the same questions-- minGW's default installation (at least with g++ alone) does not include bzip2, nor are there any instructions on how to install these packages. here's what I did after downloading the binary gdb distro. I haven't used gsb before so I can't guarantee this approach works properly, but fyi:
1. download the bzip2 executable from, rename to "bzip.exe" and put in a path folder (e.g. c:\minGW\bin). in the following, I assume you use c:\minGW as the base minGW folder
2. if you don't have it, install winzip or 7-zip
3. unpack the tarball: C:\MinGW> bzip2 -d C:\MinGW\gdb-6.8-mingw-3.tar.bz2
4. using winzip or 7-zip, unpack the resulting gdb-6.8-mingw-3.tar file to folder "gdb-6.8-mingw-3". I did not try to, and do not recommend you try to, extract into the current directory, since it could overwrite some of your shared libs etc that are being used for the rest of your minGW platform.
5. copy gdb.exe into C:\MinGW\bin. one possible problem with this is that gdb.exe might not be consistent with the versions of libs and other shared files in the minGW platform you have installed. It seemed to work for me using minGW 4.4.

Re: Getting Started

Keith, g++ link worked. Thanks for your time.

Re: Getting Started

It would be nice if the automated installer gets updated and restructured a little bit... I know, there is no time, but the installation process could be a little easier. It would be great if one could choose a major version instead of previous, current, candidate.... I mean candidate what? Then the mingw project has a lot of extra utilities that could be bundled with the download as well, like gdb or msys! yes very nice utilities! It would break the confusion between all the different download packages one has at sourceforge, since there is no real documentation about what belongs to what and which package is stable.

Re: Getting Started

keith's picture

What you describe is very much what we hope to provide, with the `mingw-get' package currently under development; however, there is currently no forecast as to when this may become available.

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, 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


but none works. I have always to add


-I/h/mingw/msys/local/include -L/h/mingw/msys/local/lib


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?


Re: Getting Started

keith's picture

See IncludePathHOWTO and SpecsFileHOWTO, (and do heed my comment following the latter).

Re: Getting Started

The G++ download is dead...

Re: Getting Started

The gcc-g++ download link works OK for me.

Re: Getting Started

SourceForge self-extractor:

  • Extracting gcc-g++-3.4.5-20060117-3.tar.gz
  • untgz::extract -d 'C:\add\MinGW' -z 'C:\add\gcc-g++-3.4.5-20060117-3.tar.gz'
  • tgz_extract: bad header checksum
  • Error: Failure reading from tarball.

Re: Getting Started

I had the same problem.

Manually downloading the file made the install successful.

Re: Getting Started, gcc-g++...tar.gz

I have the same problem, the gcc-g++-3.4.5-20060117-3.tar.gz does not install
I cannot open it like the other files with winzip

Re: Getting Started, gcc-g++...tar.gz

SourceF@#$e is acting up. It looks like its sending people to this URL to download the g++:

Just take the leading dot out and drop it in the same dir as your MinGW install and you should be good to go.

Re: Getting Started, gcc-g++...tar.gz

Since the mirror is missing in the link for gcc-g++-3.4.5-20060117-3.tar.gz, entering the following worked for me:
I just put the user_mirror=superb-west (which I noticed for other packages).

Re: Getting Started, gcc-g++...tar.gz

keith's picture

That doesn't work, for me -- it just jumps to the top level `files' page.

The correct format for the direct link is actually:


If you don't have a favourite mirror, or you don't know its name, please choose one from the list here, (or use `osdn', for SourceForge's master repository, which might help to annoy them into fixing their bug a bit quicker).

Re: Getting Started, gcc-g++...tar.gz

Those links work perfect for me, I have downloaded and uncompressed the files succesfully,


Re: Getting Started, gcc-g++...tar.gz


I can´t download the g++ files. Link broken.

What can I do?

Re: Getting Started, gcc-g++...tar.gz

keith's picture

Duh? What about reading the comments above, which tell you exactly that?

This wiki is not a forum for discussion of usage issues. Please use the list instead. We do not allow creation of comments by anonymous or untrusted users, on any page.
Site Status

Site maintenance performed successfully, site online Dec 13th 12:00 AM Eastern.