At my work, all of the project data resides on an NFS that is accessible from both Linux and Windows machines (using Samba). All of the work is done on Linux, but I'm toying with the idea of compiling some of tools for Windows so that I can debug with Visual Studio.
I already have a nice makefile that can build the code for both 32-bit or 64-bit Linux using different targets. Assuming I have Windows versions of all the external libraries somewhere on the NFS, and assuming the code is clean enough to compile under Windows, is it possible to compile and link my program for Windows using the existing makefile, on Linux? Ideally I'd like to call the makefile once and have it build all three of 32-bit Linux, 64-bit Linux and Windows.
An added plus would be the option to compile it with any Visual Studio metadata to make it easy to debug.
mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32 , for example.
"I compiled a c file on my Linux machine and named it test.exe, is it possible to run that file on windows?" - It is absolutely possible to compile a Windows executable on Linux.
The Windows Subsystem for Linux (WSL) is Microsoft's technology stack that enables native Linux binaries to run in a Windows user environment without the need to install a full fledged Linux distro — native or virtual.
Yes, you can achieve that with MinGW for example.
However, you will probably have to adapt one or two options in your makefile.
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