Skip to content

Instantly share code, notes, and snippets.

View CobaltXII's full-sized avatar
💭
Working on diep.io 🩵

CobaltXII CobaltXII

💭
Working on diep.io 🩵
View GitHub Profile
@CobaltXII
CobaltXII / cross_compiling_sdl2.md
Last active April 29, 2025 04:51
Cross-Compiling SDL2 Programs for Windows from Linux

Cross-Compiling SDL2 Programs for Windows from Linux using MinGW-w64

I'll explain how to create programs that run on Windows (.exe files) from a Linux machine. I'll explain how to compile C and C++, and how to make 32- and 64-bit programs. I'll also explain how to use third-party libraries (we'll use SDL2 here), and how to distribute the programs. We'll use the MinGW-w64 toolchain to accomplish this.

Note: MinGW-w64 is a fork of its predecessor, MinGW. They are different. If you install MinGW-w64 in a different way than shown in this document, make sure you have MinGW-w64, not just MinGW!

Installing and Using a Cross-Compiler