The basics are not too difficult:
sudo apt-get install mingw32
cat > main.c <<EOF
int main()
{
printf("Hello, World!");
}
EOF
i586-mingw32msvc-cc main.c -o hello.exe
Replace apt-get
with yum
, or whatever your Linux distro uses. That will generate a hello.exe
for Windows.
Once you get your head around that, you could use autotools, and set CC=i586-mingw32msvc-cc
CC=i586-mingw32msvc-cc ./configure && make
Or use CMake and a toolchain file to manage the build. More difficult still is adding native cross libraries. Usually they are stored in /usr/cross/i586-mingw32msvc/{include,lib}
and you would need to add those paths in separately in the configure step of the build process.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…