29 Apr 2020

Cross Compile Windows binaries on Linux

Very quick note for something that usually takes me too long to find :)

sudo apt-get install mingw-w64
# C
i686-w64-mingw32-gcc hello.c -o hello32.exe      # 32-bit
x86_64-w64-mingw32-gcc hello.c -o hello64.exe    # 64-bit
# C++
i686-w64-mingw32-g++ hello.cc -o hello32.exe     # 32-bit
x86_64-w64-mingw32-g++ hello.cc -o hello64.exe   # 64-bit

from: https://arrayfire.com/cross-compile-to-windows-from-linux/

Chad Duffey

Security Engineer