How do I cross-compile a program that compiles in Linux for Linux, in Linux for Windows?

71 views Asked by At

I am trying to compile a program that I did not write. It compiles for Ubuntu 16.04 in Ubuntu 16.04 just fine using the following commands.

qmake

make

Is there a simple way to cross compile it for Windows 32bit or 64bit via the manipulation of those commands without any changes in the programming? It is meant to be able to be compiled for windows as well. I have tried countless variations on how to do this with various libraries, all don't work, seemingly due to missing steps in the instructions (or so I'm guessing).

Edit: The program uses C++.

Edit: I am also trying to employ MXE.

1

There are 1 answers

5
NitinSingh On

Every program requires a runtime environment. Some languages are known to be compiled on most OS by offering a custom runtime for them. Depends on which programming language you are using. Example, Java programs just need a specific JRE for Linux or Windows to run. C#/.NET programs need Mono/Rosylyn variants (may not be fully supported for Linux).

You need to mention the language of your program to figure out the corresponding toolset for a given OS.