How to compile executable binaries for Windows?
First of all, install mingw-w64(for 64-bit Windows)
Then compile the source.cpp file, the command is:
for 32-bit Windows, replace the "x86_64ㄦ-w64-mingw32-g++" with "i686-w64-mingw32-g++".
The flag "-static-libstdc++" and "-static-libgcc" are for linking some standard library dependencies statically.
First of all, install mingw-w64(for 64-bit Windows)
sudo apt-get install mingw-w64
Then compile the source.cpp file, the command is:
x86_64-w64-mingw32-g++ -static-libstdc++ -static-libgcc -static -o output.exe Source.cpp
for 32-bit Windows, replace the "x86_64ㄦ-w64-mingw32-g++" with "i686-w64-mingw32-g++".
The flag "-static-libstdc++" and "-static-libgcc" are for linking some standard library dependencies statically.
留言
張貼留言