Linux – How to make Windows run Linux executables

linuxwindows

I compiled a C++ program under Linux:

make -f mymakefile

This will generate an executable, a.out. It seems this executable cannot be run in the Windows command prompt.

Best Answer

You cannot natively run a program for Linux under Windows. They are completely different operating systems.

However, there are methods you can try to run the program:

  1. Recompile the program on Windows to get a native executable
  2. Install the Windows Subsystem for Linux and run the program in that environment
  3. Install Linux in a virtual machine and run the program in that environment
  4. Install Cygwin or MinGW and recompile and run in that environment
  5. Use a cross compiler

Granted, depending on the nature of the program and its dependencies, it might not be possible to run in another environment without additional software, modifications to the source code, or at all.

Related Question