WinLibs standalone build of GCC and MinGW-w64 for Windows

Jump to:   Download | How to use from Windows Command Prompt | How to use from Code::Blocks | Philosophy | Donate

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:

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:

Threading library

GCC for Windows can be built with the follwing threading libraries:

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).

Download

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:

Release versions

UCRT runtime
MSVCRT runtime

Snapshot versions

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.

MSVCRT runtime

Other downloads

For checksum files and older releases check out the GitHub releases page.

Why?

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).

Goals

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:

Usage

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).

SET PATH=D:\Prog\winlibs64-9.2.0-7.0.0\mingw64\bin;%PATH% CD /D C:\TEMP

Create your source file(s) (helloworld.c in the example below).

NOTEPAD helloworld.c

In Notepad create the new file and then save it:

#include <stdio.h> int main () { printf("Hello world!\n"); return 0; }

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:

helloworld.exe

From Code::Blocks

Code::Blocks is a free integrated development environment (IDE) for C and C++.

Known issues

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.

License

Please see each of the components and dependancies for their respective licenses.
Here are the licenses of the most important components:

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:

Support winlibs.com

If you like this project and would like to support it please consider donating.