The MinGW from http://www.mingw.org/ does only support gcc 32 bit (host and target). The independent minGW-w64 project provides support for 64 bit, and also supports a much larger part of the Windows API. The MinGW-w64 project however does not provide official binary builds: These can be grabbed either from the personal build directories of the developers (the most popular being rubenvb), or from associated but independent projects like tdm-gcc or mingw-builds or msys2.

Source: http://wiki.qt.io/MinGW-64-bit

Answer from KindDragon on Stack Overflow
🌐
GitHub
github.com › mingw-w32
mingw-w32 · GitHub
The MinGW.OSDN Windows System Libraries. Formerly designated as "MinGW.org Windows System Libraries", this encapsulates the "mingwrt" C runtime library extensions, and the "w32api" 32-bit MS-Windows API libraries.
🌐
Gaia-gis
gaia-gis.it › gaia-sins › mingw32_how_to.html
MinGW (32 bit) how-to - gaia-gis
So you'll simply have to launch mingw32 in order to build any 32 bit executable.
🌐
Gnutoolchains
gnutoolchains.com › mingw32
Prebuilt GNU toolchain for MinGW32
MinGW32 · MinGW64 · MSP430 · PowerPC · Raspberry Pi · Raspberry Pi (64-bit) RISC-V · STMP32MP1 (Linux) STMP32MP2 (Linux) Ubuntu (x64) v850-elf · VisualGDB · Manual toolchain building · msp430-gdbproxy++ OpenOCD ·
🌐
Transmission Zero
transmissionzero.co.uk › computing › win32-apps-with-mingw
Building Win32 GUI Applications with MinGW
If you have Git installed, you can get the sample code by running “git clone https://github.com/TransmissionZero/MinGW-Win32-Application.git”. Alternatively you can download a MinGW Win32 Application source release.
🌐
SourceForge
sourceforge.net › projects › mingw
MinGW - Minimalist GNU for Windows download | SourceForge.net
A native Windows port of the GNU Compiler Collection (GCC) MinGW: A native Windows port of the GNU Compiler Collection (GCC), with freely distributable import libraries and header files for building native Windows applications; includes extensions ...
Rating: 4.3 ​ - ​ 226 votes
🌐
SourceForge
sourceforge.net › projects › mingw-w64
MinGW-w64 - for 32 and 64 bit Windows download | SourceForge.net
1 month ago - Download MinGW-w64 - for 32 and 64 bit Windows for free. A complete runtime environment for gcc. The mingw-w64 project is a complete runtime environment for gcc to support binaries native to Windows 64-bit and 32-bit operating systems.
Find elsewhere
🌐
SourceForge
sourceforge.net › home › browse › mingw-w64 - for 32 and 64 bit windows › wiki2
MinGW-w64 - for 32 and 64 bit Windows / Wiki2 / GeneralUsageInstructions
extract the toolchain to a directory: 32-bit mingw-w32: eg C:\mingw32 so that C:\mingw32\bin contains i686-w64-mingw32-gcc.exe 64-bit mingw-w64: eg C:\mingw64 so that C:\mingw64\bin contains x86_64-w64-mingw32-gcc.exe
🌐
SourceForge
sourceforge.net › home › open source software › software development › build tools › mingw - minimalist gnu for windows › files
MinGW - Minimalist GNU for Windows - Browse /MinGW/Base/pthreads-w32 at SourceForge.net
MinGW - Minimalist GNU for Windows /MinGW/Base/pthreads-w32 files. Browse /MinGW/Base/pthreads-w32 files for MinGW - Minimalist GNU for Windows, A native Windows port of the GNU Compiler Collection (GCC)
🌐
WinLibs
winlibs.com
WinLibs - GCC+MinGW-w64 compiler for Windows
WinLibs - MinGW-w64 personal build = GCC for Windows 32-bit and 64-bit - Coming soon: the largest collection of open source libraries ported to Windows using MinGW-w64 and MSYS2.
🌐
Qt Wiki
wiki.qt.io › MinGW
MinGW - Qt Wiki
April 2, 2026 - MinGW is a free and open source Windows port of the GCC compiler and related tools. Qt supports MinGW as a platform on Windows (in addition to the Visual Studio compiler by Microsoft). However, it can also be used as a cross-compiler e.g.
🌐
mingw-w64
mingw-w64.org › downloads
Pre-built Toolchains - mingw-w64
busybox-w32 : standard unix utilities, including sh · Vim : powerful text editor · Universal Ctags : source navigation · Ccache : compiler cache · The toolchain includes pthreads, C++11 threads, and OpenMP. All included runtime components are static. Installation: GitHub ·
🌐
Gentoo Wiki
wiki.gentoo.org › wiki › Mingw
MinGW - Gentoo wiki
MinGW (historically MinGW32) is a toolchain that provides a native GCC-based environment for compiling Windows binaries. It can also be used in cross-compilation setups to build binaries on other operating systems. MinGW-w64 is a fork of MinGW that adds support for 64-bit Windows executables.

The MinGW from http://www.mingw.org/ does only support gcc 32 bit (host and target). The independent minGW-w64 project provides support for 64 bit, and also supports a much larger part of the Windows API. The MinGW-w64 project however does not provide official binary builds: These can be grabbed either from the personal build directories of the developers (the most popular being rubenvb), or from associated but independent projects like tdm-gcc or mingw-builds or msys2.

Source: http://wiki.qt.io/MinGW-64-bit

Answer from KindDragon on Stack Overflow
Top answer
1 of 3
34

Look more closely at what is actually available:

edd@max:~$ apt-cache search mingw-
libassuan-mingw-w64-dev - IPC library for the GnuPG components -- Windows port
libgcrypt-mingw-w64-dev - LGPL Crypto library - Windows development
libgpg-error-mingw-w64-dev - library of error values and messages in GnuPG (Windows development)
libksba-mingw-w64-dev - X.509 and CMS support library (Windows development)
libnpth-mingw-w64-dev - replacement for GNU Pth using system threads (Windows dev)
binutils-mingw-w64 - Cross-binutils for Win32 and Win64 using MinGW-w64
binutils-mingw-w64-i686 - Cross-binutils for Win32 (x86) using MinGW-w64
binutils-mingw-w64-x86-64 - Cross-binutils for Win64 (x64) using MinGW-w64
g++-mingw-w64 - GNU C++ compiler for MinGW-w64
g++-mingw-w64-i686 - GNU C++ compiler for MinGW-w64 targeting Win32
g++-mingw-w64-x86-64 - GNU C++ compiler for MinGW-w64 targeting Win64
gcc-mingw-w64 - GNU C compiler for MinGW-w64
gcc-mingw-w64-base - GNU Compiler Collection for MinGW-w64 (base package)
gcc-mingw-w64-i686 - GNU C compiler for MinGW-w64 targeting Win32
gcc-mingw-w64-x86-64 - GNU C compiler for MinGW-w64 targeting Win64
gdb-mingw-w64 - Cross-debugger for Win32 and Win64 using MinGW-w64
gdb-mingw-w64-target - Cross-debugger server for Win32 and Win64 using MinGW-w64
gfortran-mingw-w64 - GNU Fortran compiler for MinGW-w64
gfortran-mingw-w64-i686 - GNU Fortran compiler for MinGW-w64 targeting Win32
gfortran-mingw-w64-x86-64 - GNU Fortran compiler for MinGW-w64 targeting Win64
gnat-mingw-w64 - GNU Ada compiler for MinGW-w64
gnat-mingw-w64-base - GNU Ada compiler for MinGW-w64 (base package)
gnat-mingw-w64-i686 - GNU Ada compiler for MinGW-w64 targeting Win32
gnat-mingw-w64-x86-64 - GNU Ada compiler for MinGW-w64 targeting Win64
gobjc++-mingw-w64 - GNU Objective-C++ compiler for MinGW-w64
gobjc++-mingw-w64-i686 - GNU Objective-C++ compiler for MinGW-w64 targeting Win32
gobjc++-mingw-w64-x86-64 - GNU Objective-C++ compiler for MinGW-w64 targeting Win64
gobjc-mingw-w64 - GNU Objective-C compiler for MinGW-w64
gobjc-mingw-w64-i686 - GNU Objective-C compiler for MinGW-w64 targeting Win32
gobjc-mingw-w64-x86-64 - GNU Objective-C compiler for MinGW-w64 targeting Win64
libz-mingw-w64 - compression library - Windows runtime
libz-mingw-w64-dev - compression library - Windows development files
mingw-ocaml - ocaml-mingw-w64 transitional dummy package
mingw-w64 - Development environment targeting 32- and 64-bit Windows
mingw-w64-common - Common files for Mingw-w64
mingw-w64-i686-dev - Development files for MinGW-w64 targeting Win32
mingw-w64-tools - Development tools for 32- and 64-bit Windows
mingw-w64-x86-64-dev - Development files for MinGW-w64 targeting Win64
ocaml-mingw-w64 - OCaml cross-compiler based on mingw -- Meta-package
ocaml-mingw-w64-i686 - OCaml cross-compiler based on mingw -- 32 bit compiler
ocaml-mingw-w64-x86-64 - OCaml cross-compiler based on mingw -- 64 bit compiler
edd@max:~$

So sudo apt-get install gcc-mingw-w64 is probably what you want, and you should get a 32-bit executable built by setting the appropriate compiler option, likely -m32.

2 of 3
6

I tried sudo apt-get install gcc-mingw-w64.

And then I compile the code with the command :

i686-w64-mingw32-gcc-win32 input_code.c -o output.exe
🌐
Wikipedia
en.wikipedia.org › wiki › MinGW
MinGW - Wikipedia
October 6, 2026 - MinGW ("Minimalist GNU for Windows") is a compiler toolchain for creating native Microsoft Windows applications. It provides a port of the GNU Compiler Collection (GCC) and related tools that generate executables targeting the Windows API without requiring a compatibility layer or emulation ...
🌐
GitHub
gist.github.com › charitra1022 › dbc6de742452bff3680782d343e5289b
MSYS2 -> Installation of MinGW (32-Bit) · GitHub
Msys2 doesn't seem to come with a mingw32 launcher these days so idk how I would actually use it since it's part of the mingw32 environment but there is no mingw32 launcher, at least there wasn't when I installed the latest msys2 version EDIT: never mind, I actually checked the msys64 folder and there was actually a mingw32.exe there, there just wasn't a start menu shortcut created for it for some reason
🌐
SourceForge
sourceforge.net › home › open source software › software development › build tools › mingw - minimalist gnu for windows › files
MinGW - Minimalist GNU for Windows - Browse /MinGW/Base/w32api at SourceForge.net
MinGW - Minimalist GNU for Windows /MinGW/Base/w32api files. Browse /MinGW/Base/w32api files for MinGW - Minimalist GNU for Windows, A native Windows port of the GNU Compiler Collection (GCC)