Skip to content

Fedora

Installation

Install the 64bit C and C++ cross-compilers:

$ sudo dnf install mingw64-gcc-c++
$ sudo dnf install ucrt64-gcc-c++

To check the version of the provided GCC and mingw-w64:

$ dnf info --installed mingw64-gcc | grep Version
Version      : 14.2.1  # GCC Version
$ dnf info --installed mingw64-crt | grep Version
Version      : 12.0.0  # mingw-w64 Version
$ dnf info --installed ucrt64-gcc | grep Version
Version      : 14.2.1  # GCC Version
$ dnf info --installed ucrt64-crt | grep Version
Version      : 12.0.0  # mingw-w64 Version

Building

Cross compiling a Windows executable:

// hello.c
#include <stdio.h>

int main(void) {
    printf("Hello, Windows!\n");
    return 0;
}
$ x86_64-w64-mingw32-gcc hello.c -o hello.exe
$ x86_64-w64-mingw32ucrt-gcc hello.c -o hello.exe

Testing

Testing on Linux using Wine:

$ sudo dnf install wine
$ wine hello.exe
Hello, Windows!