Reputation: 3593
I would like to compile a c++ program in cygwin (on windows) and then run it on a Linux machine.. The reason I don't want to just compile it on Linux is missing libraries, and a huge mess (including restricted access) to install these.
I was hoping I could just compile it, then copy the programname.exe-file to my linux folder and then run ./programname. But that doesn't work. Is there any way to do this?
Upvotes: 1
Views: 963
Reputation: 409176
Short answer is: You can't.
Longer answer: You can, but then you have to set up a cross-compiler that generates native Linux binaries. Or use an environment such as WINE in Linux.
The reason you can't just copy an executable file from Windows, even when compiled with GCC, is that the file have a specific format that is not seen as executable on Linux.
Upvotes: 2