Compile C using gcc for Windows in Ubuntu

1. Install mingw cross-compiler: 
apt install mingw-w64
2.a. Compile for 32-bit executable:
i686-w64-mingw32-gcc -o main32.exe main.c
2.b. Compile for 64-bit executable:
x86_64-w64-mingw32-gcc -o main64.exe main.c

Popular Posts