Ok, guys, hope this is quite a simple question: is there any way to run a C program compiled under linux with gcc on a windows operating system? Please don't tell me to recompile it under windows, since I already tried but looks like no c windows compiler has 128 bit native type, and using bignum libraries makes my program like 10 to 100 times slower. Is there any way to actually RUN the linux binary under windows? Someone told me something about cygwin, but I don't know where to get started with it. (My program should be portable as well, so I souldn't need to install programs and stuff on my machine).
Thank you very much!! Matteo
Is there a way to compile the program on Linux (i.e. Ubuntu) is such a way that the .exe file can just run on Window without any need to recompile it on Windows? Yes. To build a program on linux which runs on Windows, you need to use a cross-compiling tool chain which builds code with links to Windows run-times.
Many people confuse the compiler with the compiler plus the libraries that are often distributed with it. GCC will compile code just fine for use on Windows. GNU's LibC will usually (not always) work for cross compiling to Windows as long as you have an intermediary level for it to work with like MinGW.
No direct way. A Linux executable has a radically different format than Windows. There are several other options.
cygwin. Compile the program with GCC under cygwin. I believe that will build a windows exe that uses the cygwin compatibility layer.
install a VM like VBox. Install a Linux in the VBox. Run the program there.
http://www.andlinux.org has a framework for doing this. I've never tried it, but there is a video tutorial http://www.youtube.com/watch?v=nULDHPCm9p4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With