MinGW ("Minimalistic GNU for Windows") is a collection of freely available and freely distributable Windows specific header files and import libraries combined with GNU toolsets that allow one to produce native Windows programs that do not rely on any 3rd-party C runtime DLLs.
MinGW refers to a set of runtime headers, used in building a compiler system based on the GNU GCC and binutils projects. It compiles and links code to be run on Win32 platforms... providing C, C++ and Fortran compilers plus other related tools. If you see references to "mingw32" instead of "MinGW", they are referring to the same compiler system. The project's name changed from mingw32 to MinGW is to prevent the implication that MinGW will only works on 32 bit systems (as 64 and higher bit machines become more common, MinGW will evolve to work with them). MinGW uses the Microsoft runtime libraries, distributed with the Windows operating system. Unlike other ports of GCC to Windows, the runtime libraries are not distributed using GNU's General Public License (GPL). You, therefore, do not have to distribute your source code with your programs unless, of course, you use a GPL library in your programs. Initially, MinGW was an assortment of individual packages... the MinGW runtime, various applications built using that runtime (gcc, ld, etc.), and other useful components (the w32api headers needed to code for the Win32 API). Developers "rolled their own" MinGW environments by downloading the latest versions of each individual package needed. This was necessary given the dynamic nature of early package versions (updates being posted constantly)... but was oftentimes confusing for newbies, and made it difficult for application/library vendors to design products that build with a "standard" MinGW environment. Therefore, around mid-2001 when development had matured and updates were not being packaged as rapidly, the decision was made to create a single-file distribution of the standard MinGW environment. This single archive contains the files from each component package, bundled and ready to extract. The individual component packages are still available for download... if a particular package is updated in between releases of the overall distribution, it's possible to simply drop the newer package in place over a distribution install.
Comparison to Other Compiler Suites
MinGW is a port of the free GCC compiler to Windows. It allows anyone to download and compile code in several languages (C, C++, ADA, Fortran and Java) for native Windows (using only the Win32 API) using only Free Software.
Unlike Cygwin, MinGW doesn't provide Linux or Unix system calls or a POSIX emulation layer. Some POSIX compatibility is provided by the supported runtime library, msvcrt.dll. A few additional functions are provided to help with portability. However, most likely a POSIX application would need to be ported to use Windows APIs in order to compile with MinGW, just as you would to compile with MSVC or Borland or Watcom C++.
Why the need for MinGW when there are many free C compilers for Windows out there? According to this mailing list thread, there are no high quality Free (open-source) C compilers for Windows, or free (as in beer) compilers for C++ or other languages that are compatible with the GNU compiler suite.
Now that Microsoft gives away Visual Studio for free, the Windows compiler market is in poor shape, and other commercial competitors will likely fade over time. Borland has stopped maintaining their free compiler version. lcc-win32 only supports C. Djgpp only builds executables targeted to DOS 32 bit. OpenWatcom was originally a commercial project. It didn't pay for the companies that acquired it to maintain the compiler further. Luckily, it has been added to the list of Open Source C/C++ compilers thanks to the efforts of Scitech. However, it is not very compatible with GNU compiler standards and can be difficult to use in building Open Source not specifically designed for compiling with Watcom. It also only supports C/C++ and Fortran. Same for the Digital Mars project (although it's C/C++ only) which is now also selling parts of its compiler. That will leave MSVC and MinGW as the only high-quality native compilers for Windows.
Was the only reason the ability to use the UNIX-like access via command line instead of a GUI based developing environment? Well, most of us come from a UNIX background so we prefer the command line, but as far as we know, all free and non-free compilers provide command-line tools, including a compiler and a linker (and often some sort of 'make'), even if they emphasize an IDE.
Wouldn't Cygwin be sufficient if using POSIX system calls would be avoided? Although it's possible to use the Windows API from Cygwin, you're still tied to the cygwin DLL with its GPL license, and that restricts the distribution of software compiled with it. MinGW places no such restrictions on the distribution of your software. MSVC similarly creates a dependency on the Microsoft runtime which is large, heavy and non-redistributable.
Cygwin itself uses MinGW to compile the cygwin DLL, which obviously cannot depend on Cygwin. Therefore, without MinGW, Cygwin would have to be compiled with a non-free compiler.
Applications also run faster without POSIX-emulation overhead, and in some cases introducing the Cygwin DLL into an existing application would cause conflicts with the native functions of the same name, which might cause the application to become unstable. Therefore compiling application extensions, components and DLLs with MinGW can be safer than using Cygwin.
One thing that some people like about GCC (and hence MinGW) over other compilers is the higher level of ANSI compliance, which improves portability of applications developed with it.
Packages included in MinGW
- binutils - Assembler, linker, ...
- mingw-runtime - Headers and libraries for the C library
- w32api - Windows API header files and libraries
- gcc-core - C compiler
- gcc-g++ - C++ compiler
- gcc-objc - Objective C compiler
- gcc-gfortran - Fortran 90/95 compiler
- gcc-java - Java compiler
- gcc-ada - Ada compiler
- mingw-gdb - Windows native build of GNU debugger
- mingw32-make - Windows native build of GNU make
- mingw-utils - Miscellaneous utilities
Contents of MinGW Packages
- binutils: A native port of the GNU binutils. Amongst other tools, this package contains the assembler and linker, which will transform the output of the compiler into a binary executable. You must install this package, together with gcc-core, to obtain a correctly functioning compiler suite.
- mingw-runtime: Header files and import libraries for the default C runtime library, (also known as msvcrt), which is required by MinGW compiled programs running on the Microsoft Windows operating system. You must install this package, together with gcc-core, to obtain a correctly functioning compiler suite.
- w32api: Header files and import libraries for the Microsoft Windows operating system; this provides the Application Programming Interface (API) required to access the essential operating system service functions, which are required by any working native Windows application. You must install this package, together with gcc-core, to obtain a correctly functioning compiler suite.
- gcc: A native port of the GNU gcc compiler. This is the application which parses source files, translating them to linkable object code. Note that the gcc package set is subdivided into a gcc-core package, which provides only a C compiler, with additional supplementary packages for additional programming languages. You must get at least the gcc-core package; if you also wish to add any supplementary languages, please ensure that you get the appropriate packages, with the same version number as the gcc-core package.
- mingw-gdb: A native port of GNU debugger.
- mingw32-make: A native port of GNU make. This application parses makefiles to create a project by following the rules expressed in the makefile.
- mingw-utils: Miscellaneous utilities.
MinGW contains several different packages. Some of those packages are licensed by the GNU Public License (GPL), some are licensed in the Public Domain and some have their own versions of a license. See [[mingw:license|Licensing Terms]]
It can be download from [http://sourceforge.net/projects/mingw/ Sourceforge's MinGW project page] after you click the "Files" link. The package's name is MINGW-NNN.exe, (where "NNN" represents the current version number, e.g. version "5.1.6" is distributed as "MinGW-5.1.6.exe").