WinLibs standalone build of GCC and MinGW-w64 for Windows
How to use from Windows Command Prompt
How to use from Code::Blocks
What is it?
In short: it's a free C and C++ compiler for Microsoft Windows.
GCC (GNU Compiler Collection) is a free and open source compiler for C and C++ (and other languages like Objective-C, Fortran, D).
MinGW-w64 is a free and open source C library for targetting Windows 32-bit and 64-bit platforms.
The combination of these results in a free C/C++ compiler for Windows.
Even though GCC and MinGW-w64 can be used on other platforms (e.g. Linux) to generate Windows executables, the WinLibs project only focusses on building versions that run natively on Windows.
Also some additional tools are added, including:
- GDB - the GNU Project debugger
- GNU Binutils - a collection of binary tools
- GNU Make - a tool which controls the generation of executables and other non-source files
- Yasm - The Yasm Modular Assembler Project
- NASM - The Netwide Assembler
- JWasm - A free MASM-compatible assembler
- LLVM/Clang/LLD/LLDB - The LLVM Compiler Infrastructure
This is a standalone build, which means this download offers a complete compiler environment for Windows.
In the future WinLibs plans to also release binary packages of many open source libraries and applications built with this compiler.
Click here to see the philosophy and design decisions behind winlibs.com.
Who is it for?
WinLibs could be just what you are looking in these case:
- You are using Microsoft Windows and want to start programming in C and/or C++ using completely free software.
To get started more easily you should probably use an IDE like Code::Blocks.
- You have written software using another proprietary compiler (like Microsoft Visual C/C++ and Visual Studio) and would like to test if your application compiles using the the most common C/C++ compiler available: GCC.
- You have written software for Windows but would like to port it to other plaftorms (like Linux or Apple macOS).
When using the MSYS2 command line you get access to most command line tools that are also available on those other platforms (like GNU Autotools), allowing you create standard build instructions across platforms (like: ./configure && make && make install).
Another way of configuring your build for each platform is by using CMake, which is also available for many platforms (including Windows).
- You are used to developing for another platform like Linux or Apple macOS and would like to start programming for Windows.
If you use MSYS2 you won't have to learn any new commands. Or if your existing project(s) already use configuration tools like GNU Autotools or CMake you can start building for Windows in no time.
- You are C++ developer who can't wait to try out the latest C++ standard.
GCC is always very quick to implement new C++ standards. You may even want to consider using the latest snapshot version.
GCC for Windows can be built with the follwing threading libraries:
- POSIX (best compatibility with other platforms)
- WIN32 (native Windows thread but misses POSIX threads / pthread.h)
- MCF (since GCC 13, see also: MCF Gthread Library)
For portability reasons (compatibility with other platforms) the builds published here use the POSIX threading library.
Since GCC 13 some builds with the MCF threading model were also released.
MSVCRT or UCRT runtime library?
Traditionally the MinGW-w64 compiler used MSVCRT as runtime library, which is available on all versions of Windows.
Since Windows 10 Universal C Runtime (UCRT) is available as an alternative to MSVCRT.
Universal C Runtime can also be installed on earlier versions of Windows (see: Update for Universal C Runtime in Windows).
Unless you are targetting older versions of Windows, UCRT as runtime library is the better choice, as it was written to better support recent Windows versions as well as provide better standards conformance (see also: Upgrade your code to the Universal CRT).
The following downloads are available (for Windows only).
*You will need a decompressor like 7-Zip (free) to unzip .7z archives, but they are a lot smaller than .zip files.
Each version comes in 2 flavors:
- Win32 - i686 - Windows 32-bit version, runs natively on and compiles for Windows 32-bit (also runs on Windows 64-bit, but in 32-bit mode)
- Win64 - x86_64 - Windows 64-bit version, runs natively on and compiles for Windows 64-bit (will not run on Windows 32-bit)
- GCC 13.1.0 (with POSIX threads) + LLVM/Clang/LLD/LLDB 16.0.5 + MinGW-w64 11.0.0 (UCRT) - release 5 (LATEST)
- GCC 13.1.0 (with MCF threads) + MinGW-w64 11.0.0 (UCRT) - release 3 (LATEST)
- GCC 12.3.0 + LLVM/Clang/LLD/LLDB 16.0.4 + MinGW-w64 11.0.0 (UCRT) - release 1
- GCC 12.2.0 + LLVM/Clang/LLD/LLDB 16.0.0 + MinGW-w64 10.0.0 (UCRT) - release 5
- GCC 12.1.0 + LLVM/Clang/LLD/LLDB 14.0.6 + MinGW-w64 10.0.0 (UCRT) - release 3
- GCC 11.3.0 + LLVM/Clang/LLD/LLDB 14.0.3 + MinGW-w64 10.0.0 (UCRT) - release 3
- GCC 11.2.0 + MinGW-w64 10.0.0 (UCRT) - release 1
- GCC 11.2.0 + LLVM/Clang/LLD/LLDB 14.0.0 + MinGW-w64 9.0.0 (UCRT) - release 7
- GCC 13.1.0 (with POSIX threads) + LLVM/Clang/LLD/LLDB 16.0.5 + MinGW-w64 11.0.0 (MSVCRT) - release 5 (LATEST)
- GCC 13.1.0 (with MCF threads) + MinGW-w64 11.0.0 (MSVCRT) - release 3 (LATEST)
- GCC 12.3.0 + LLVM/Clang/LLD/LLDB 16.0.4 + MinGW-w64 11.0.0 (MSVCRT) - release 1
- GCC 12.2.0 + LLVM/Clang/LLD/LLDB 16.0.0 + MinGW-w64 10.0.0 (MSVCRT) - release 5
- GCC 12.1.0 + LLVM/Clang/LLD/LLDB 14.0.6 + MinGW-w64 10.0.0 (MSVCRT) - release 3
- GCC 11.3.0 + LLVM/Clang/LLD/LLDB 14.0.3 + MinGW-w64 10.0.0 (MSVCRT) - release 3
- GCC 11.2.0 + MinGW-w64 10.0.0 (MSVCRT) - release 1
- GCC 11.2.0 + LLVM/Clang/LLD/LLDB 14.0.0 + MinGW-w64 9.0.0 (MSVCRT) - release 7
- GCC 10.4.0 + MinGW-w64 10.0.0 (MSVCRT) - release 1
- GCC 10.3.0 + LLVM/Clang/LLD/LLDB 12.0.0 + MinGW-w64 9.0.0 (MSVCRT) - release 2
- GCC 9.5.0 + MinGW-w64 10.0.0 (MSVCRT) - release 1
- GCC 8.5.0 + MinGW-w64 9.0.0 (MSVCRT) - release 1
- GCC 7.5.0 + MinGW-w64 7.0.0 (MSVCRT) - release 1
In between release versions of GCC occasional snapshots are made available. As these are not actual releases they should not be treated as such.
Snapshots versions may be useful to test the latest features or check for bugs when building with the latest versions.
- GCC 13.0.1 snapshot 20230402 (experimental) + MinGW-w64 11.0.0-prerelease (MSVCRT, MCF threads) - release 1
- GCC 12.0.1 snapshot 20220123 (experimental) + MinGW-w64 9.0.0 (MSVCRT) - release 1
- GCC 11.2.1 snapshot 20211106 (experimental) + MinGW-w64 9.0.0 (MSVCRT) - release 1
- GCC 10.3.1 snapshot 20211112 (experimental) + MinGW-w64 9.0.0 (MSVCRT) - release 1
- GCC 9.4.1 snapshot 20211202 (experimental) + MinGW-w64 9.0.0 (MSVCRT) - release 1
For checksum files and older releases check out the GitHub releases page.
GCC already runs on many different platforms (including GNU/Linux and Apple macOS) and had been around for a long time (since 1987).
C - and derived languages like C++ and Objective-C - are the preferred programming languages for a lot of software, including many open source projects, and even for operating systems themselves.
Having a GCC compiler on Windows allows making Windows versions of many software projects that already exist for other operating systems (e.g. GNU/Linux).
This allows application developers to build native binaries of their software for multiple operating systems including Windows.
But also, when starting software projects from scratch, it opens up the possibility to use many existing (open source) libraries and better future portability to other platforms (if the developer(s) avoid calling native Windows functions).
Each release build is built with itself or a newer release, so optimizations included in newer GCC versions are also compiled into the compiler itself.
The ultimate goal of WinLibs is to also provide libraries built with this compiler, in order to provide a comprehensive C/C++ development environment, with the following goals in mind:
- provide both static and shared libraries where possible
- focus on production quality (no debug versions of libraries and debugging information stripped from binaries)
- useability from the MSYS2 shell aswell as from IDEs like Code::Blocks
- no installation or registry requirements and disk location independant
From the Windows Command Prompt
Compiling from the console isn't generally the most easy way of building software, but this explanation shows how you can get started quickly.
Open the Windows Command Prompt.
Make sure the mingw32/bin or mingw64/bin folder from the extracted download is in your PATH and its location doesn't contain any spaces.
Go to the directory where your source files are (C:\Temp in the example below).
CD /D C:\TEMP
Create your source file(s) (helloworld.c in the example below).
In Notepad create the new file and then save it:
int main ()
Compile the example:
gcc -o helloworld.exe helloworld.c
Or if you want to compile and link in seperate steps:
gcc -c -o helloworld.o helloworld.c
gcc -o helloworld.exe helloworld.o
Then you can run the compiled program:
Code::Blocks is a free integrated development environment (IDE) for C and C++.
- Open Code::Blocks
- Configure debugger
- In the top menu go to Settings and select Debugger...
- In the left pane select GDB/CDB debugger
- Click Create Config and enter a name (e.g. Debug_MINGW32 for 32-bit (i686) or Debug_MINGW64 for 64-bit (x86_64))
- Select this new entry on the left
- Set the location of bin\gdb.exe under the mingw32 or mingw64 folder from the extracted download (you can also browse to it by clicking on the ... button)
- Leave the other settings to their defaults (including Debugger type = GDB) and press OK
- Configure compiler
- In the top menu go to Settings and select Compiler...
- Under Selected compiler choose GNU GCC Compiler
- Click Copy and enter a name (e.g. MINGW32 for 32-bit (i686) or MINGW64 for 64-bit (x86_64))
- Under Selected compiler choose this new entry (should be at the bottom of the list)
- Click the tab Toolchain executables
- Under Compiler's installation directory set the location of the mingw32 or mingw64 folder from the extracted download (you can also browse to it by clicking on the ... button)
- Click the tab Program Files set the following settings (taking into account 32-bit (i686) or for 64-bit (x86_64))
- C compiler: i686-w64-mingw32-gcc.exe / x86_64-w64-mingw32-gcc.exe
- C++ compiler: i686-w64-mingw32-g++.exe / x86_64-w64-mingw32-g++.exe
- Linker for dynamic libs: i686-w64-mingw32-g++.exe / x86_64-w64-mingw32-g++.exe
- Linker for static libs: i686-w64-mingw32-gcc-ar.exe / x86_64-w64-mingw32-gcc-ar.exe
- Debugger: Debug_MINGW32 / Debug_MINGW64 (as created earlier)
- Resource compiler: windres.exe
- Make program: mingw32-make.exe
- Create new project
- Go to File / New / Project...
- Select project template you need (like Console application) and click Go
- Step through the wizard which will ask serveral questions, including of your project is in C or C++, the name of your project and where to save it
- On the last page under Compiler select the compiler you wish to use (e.g. MINGW32 for 32-bit (i686) or MINGW64 for 64-bit (x86_64)) and click Finish
- An example main.c file will be created automatically, which you can modify as needed
- Press the F9 key to compile, link and run the application
Problem: In some cases (e.g. when building GCC 10.2.0) there are printf format compiler errors when building against MinGW-w64 8.0.0. See MinGW-w64 ticket #853.
Solution: No general soluton yet. To fix building GCC 10.2.0 replace #include <inttypes.h> with # undef HAVE_INTTYPES_H in libgomp/target.c and libgomp/oacc-parallel.c.
Problem: When building software that sets _FORTIFY_SOURCE to something other than 0 there are errors when building against MinGW-w64 7.0.0. See MinGW-w64 ticket #818.
Solution: Add linker flag -lssp somewhere after the source or object files.
For example for most projects using autoconf tools just add LIBS="-Wl,--as-needed -lssp" at the end of the ./configure line.
Release 2 was built with configure flag --enable-default-ssp to resolve this.
Problem: When using GCC 10 there are multiple definition of `<symbol>' linker errors that weren't there when using earlier versions of GCC.
Solution: Add compiler flag -fcommon. See this link for more information.
Please see each of the components and dependancies for their respective licenses.
Here are the licenses of the most important components:
- GCC: GPL
- MinGW-w64: Zope Public License (ZPL) with exceptions
- GDB: GPL
- GNU Binutils: GPL
- GNU Make: GPL
- Yasm: 2-clause BSD license
- NASM: 2-clause BSD license
- JWasm: Sybase Open Watcom Public License version 1.0
- LLVM/Clang/LLD/LLDB: Apache License
Who are you?
My name is Brecht Sanders, and I have been a passionate open source user and developer for many years.
Around 2006 I discovered MinGW (and later MinGW-w64) as a great way to build libraries and applications with GCC on Windows.
This has the following advantages:
- programming in C and/or C++ for native Windows without the need to install any development software from Microsoft or other commercial companies
- possibility to compile many of the open source packages the Linux/Unix world has to offer for native Windows, especially when used in combination with MSYS2
- write portable cross platform software in C and/or C++ using the same compiler and build tools as on the other platforms (like Linux and macOS)
If you like this project and would like to support it please consider donating.