How do I make Windows run Linux executables?
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.
linux windows
|
show 2 more comments
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.
linux windows
4
without ever doing this id think you would have to use a cross compiler
– Hayden Thring
Sep 25 '18 at 0:44
32
Since it's a C++ program, why don't you consider compiling and delivering the executable on a windows machine separately?
– Raju Devidas
Sep 25 '18 at 0:45
8
Can you explain what the C++ program does? If it's a command line program, then it would probably work if recompiled under the correct compiler on Windows (I presume GCC, but depends on the code). If it uses a GUI, then maybe it could compile on Windows, but maybe not. If it's some sort of daemon or device driver, then almost definitely, it won't compile on Windows.
– Neil
Sep 25 '18 at 7:43
3
Please do not cross post: stackoverflow.com/questions/52490846/…
– Greenonline
Sep 26 '18 at 14:22
2
@Greenonline Both that question and this one may have arisen from the same fundamental misunderstanding of the problems involved in sharing binary code across operating systems, but the actual questions being asked are very different. This is not a case of cross posting.
– jmbpiano
Sep 26 '18 at 19:22
|
show 2 more comments
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.
linux windows
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.
linux windows
linux windows
edited Sep 25 '18 at 8:30
Peter Mortensen
8,361166185
8,361166185
asked Sep 25 '18 at 0:39
Terry QiaoTerry Qiao
5824
5824
4
without ever doing this id think you would have to use a cross compiler
– Hayden Thring
Sep 25 '18 at 0:44
32
Since it's a C++ program, why don't you consider compiling and delivering the executable on a windows machine separately?
– Raju Devidas
Sep 25 '18 at 0:45
8
Can you explain what the C++ program does? If it's a command line program, then it would probably work if recompiled under the correct compiler on Windows (I presume GCC, but depends on the code). If it uses a GUI, then maybe it could compile on Windows, but maybe not. If it's some sort of daemon or device driver, then almost definitely, it won't compile on Windows.
– Neil
Sep 25 '18 at 7:43
3
Please do not cross post: stackoverflow.com/questions/52490846/…
– Greenonline
Sep 26 '18 at 14:22
2
@Greenonline Both that question and this one may have arisen from the same fundamental misunderstanding of the problems involved in sharing binary code across operating systems, but the actual questions being asked are very different. This is not a case of cross posting.
– jmbpiano
Sep 26 '18 at 19:22
|
show 2 more comments
4
without ever doing this id think you would have to use a cross compiler
– Hayden Thring
Sep 25 '18 at 0:44
32
Since it's a C++ program, why don't you consider compiling and delivering the executable on a windows machine separately?
– Raju Devidas
Sep 25 '18 at 0:45
8
Can you explain what the C++ program does? If it's a command line program, then it would probably work if recompiled under the correct compiler on Windows (I presume GCC, but depends on the code). If it uses a GUI, then maybe it could compile on Windows, but maybe not. If it's some sort of daemon or device driver, then almost definitely, it won't compile on Windows.
– Neil
Sep 25 '18 at 7:43
3
Please do not cross post: stackoverflow.com/questions/52490846/…
– Greenonline
Sep 26 '18 at 14:22
2
@Greenonline Both that question and this one may have arisen from the same fundamental misunderstanding of the problems involved in sharing binary code across operating systems, but the actual questions being asked are very different. This is not a case of cross posting.
– jmbpiano
Sep 26 '18 at 19:22
4
4
without ever doing this id think you would have to use a cross compiler
– Hayden Thring
Sep 25 '18 at 0:44
without ever doing this id think you would have to use a cross compiler
– Hayden Thring
Sep 25 '18 at 0:44
32
32
Since it's a C++ program, why don't you consider compiling and delivering the executable on a windows machine separately?
– Raju Devidas
Sep 25 '18 at 0:45
Since it's a C++ program, why don't you consider compiling and delivering the executable on a windows machine separately?
– Raju Devidas
Sep 25 '18 at 0:45
8
8
Can you explain what the C++ program does? If it's a command line program, then it would probably work if recompiled under the correct compiler on Windows (I presume GCC, but depends on the code). If it uses a GUI, then maybe it could compile on Windows, but maybe not. If it's some sort of daemon or device driver, then almost definitely, it won't compile on Windows.
– Neil
Sep 25 '18 at 7:43
Can you explain what the C++ program does? If it's a command line program, then it would probably work if recompiled under the correct compiler on Windows (I presume GCC, but depends on the code). If it uses a GUI, then maybe it could compile on Windows, but maybe not. If it's some sort of daemon or device driver, then almost definitely, it won't compile on Windows.
– Neil
Sep 25 '18 at 7:43
3
3
Please do not cross post: stackoverflow.com/questions/52490846/…
– Greenonline
Sep 26 '18 at 14:22
Please do not cross post: stackoverflow.com/questions/52490846/…
– Greenonline
Sep 26 '18 at 14:22
2
2
@Greenonline Both that question and this one may have arisen from the same fundamental misunderstanding of the problems involved in sharing binary code across operating systems, but the actual questions being asked are very different. This is not a case of cross posting.
– jmbpiano
Sep 26 '18 at 19:22
@Greenonline Both that question and this one may have arisen from the same fundamental misunderstanding of the problems involved in sharing binary code across operating systems, but the actual questions being asked are very different. This is not a case of cross posting.
– jmbpiano
Sep 26 '18 at 19:22
|
show 2 more comments
7 Answers
7
active
oldest
votes
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:
- Recompile the program on Windows to get a native executable
- Install the Windows Subsystem for Linux and run the program in that environment
- Install Linux in a virtual machine and run the program in that environment
- Install Cygwin or MinGW and recompile and run in that environment
- 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.
38
Depending on how you look at it, running under WSL is "native" under Windows, though not pre-installed by default.
– Bob
Sep 25 '18 at 8:14
13
@Bob In the same sense that running a Windows program under WINE is “native”.
– Socob
Sep 25 '18 at 12:21
17
@Socob Not quite: WSL is part of the NT kernel. But otherwise, yes Wine is as close as you'll get to running a Win32 binary natively on Linux.
– Bob
Sep 25 '18 at 13:17
1
Using a VM with Debian (without desktop) + Putty + xming is actually a really cool setup to test Linux executables. Also, it has the added benefict of adding a little bit of safety, since it runs in a separate system. If you install a malicious program or, in the worst case, a mirror gets hacked and distributes infected updates, it will only affect one machine in a different subnet (by default).
– Ismael Miguel
Sep 26 '18 at 1:49
7
@Bob the reason WINE can run in userspace and WSL must have kernel components is that on Linux syscalls are part of the ABI, whereas on Windows everything is virtualized via calls to functions in ntdll.dll
– kinokijuf
Sep 26 '18 at 7:47
|
show 1 more comment
You need the Linux subsystem for Windows (WSL) and a Linux distribution. The Windows store has a few Linux distributions prepackaged with WSL. Ubuntu is fairly popular, but since you already have a Linux system on which you built a.out
, it might be easiest to match that.
If you can't match the Linux distributions, and a.out
doesn't work as-built, it's also possible to re-run make
on your WSL distribution
1
The SuSE version works quite well too.
– cup
Sep 26 '18 at 9:44
add a comment |
The answer above covered most of the aspects, but not sure if have come across flinux (sometimes called foreign linux) which happens to have been also suggested here and may be an easier workaround depending on what you are trying to achieve.
(Note I have WSL and work with emulators and VMs a lot, and I haven't really explorer other workarounds :))
Foreign LINUX is a dynamic binary translator and a Linux system call
interface emulator for the Windows platform. It is capable of running
unmodified Linux binaries on Windows without any drivers or
modifications to the system. This provides another way of running
Linux applications under Windows in constrast to Cygwin and other
tools. It now runs a large bunch of console applications and some GUI
applications.
add a comment |
You can cross compile for Windows on Linux.
See https://stackoverflow.com/questions/2033997/how-to-compile-for-windows-on-linux-with-gcc-g
This allows you to use Linux to compile a binary executable program that runs under Windows.
add a comment |
Another option which is similar to running a Virtual machine, but not exactly the same is running your application from a Docker container.
Yes Docker for Windows uses a VM in the background (MobyLinuxVM on HyperV), but you can do something like this:
$ docker run a.out
and will stop the container on its own. It will also use less resources and the output can be read from Windows own terminals like cmd and PowerShell.
A dockerfile for this situation will look something like this:
FROM docker pull ubuntu:latest
RUN make -f mymakefile
I think personally this is the nicest solution for running Linux applications in Windows
add a comment |
For this particular case I myself used to install gcc on my windows 8 by mingw.
Then I would add path of my mingw folder to system path (from control panel/system/advanced system settings).
Then I could run gcc on my command prompt just like linux.
add a comment |
Try to get the windows exe or msi equivalent of the linux executable and run or use cygwin to install linux executable.
There is a tool mobaxterm very helpful, have a look and you can get your task done. This tool has cygwin and other linux utility to proceed with.
Source: https://www.quora.com/How-do-I-run-Linux-executable-on-windows
4
MobaXterm appears to be a tool to access remote systems from a Windows system. It provides a terminal window (X server) and acts as ssh client. Therefore, it might help to develop and compile on a remote Unix system, but it has no cross compilation features.
– Axel Kemper
Sep 25 '18 at 9:38
9
There won't be an equivalent MSI or EXE because the OP is compiling the code themselves.
– selectstriker2
Sep 25 '18 at 14:35
2
@AxelKemper I used MobaXterm years ago. If I recall, what you describe was a main attraction, but it actually did more than that. I do not recall exactly how much more, and I am not sure if it could be used as this answer states, but there was indeed more to it than is apparent on the surface.
– Aaron
Sep 25 '18 at 22:18
2
The linked source from quora seems low quality and difficult to understand.
– Aaron
Sep 25 '18 at 22:20
4
@Aaron - It's also not quoted, so this answer, is not much more than a link only answer.
– Ramhound
Sep 25 '18 at 23:41
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1361051%2fhow-do-i-make-windows-run-linux-executables%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
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:
- Recompile the program on Windows to get a native executable
- Install the Windows Subsystem for Linux and run the program in that environment
- Install Linux in a virtual machine and run the program in that environment
- Install Cygwin or MinGW and recompile and run in that environment
- 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.
38
Depending on how you look at it, running under WSL is "native" under Windows, though not pre-installed by default.
– Bob
Sep 25 '18 at 8:14
13
@Bob In the same sense that running a Windows program under WINE is “native”.
– Socob
Sep 25 '18 at 12:21
17
@Socob Not quite: WSL is part of the NT kernel. But otherwise, yes Wine is as close as you'll get to running a Win32 binary natively on Linux.
– Bob
Sep 25 '18 at 13:17
1
Using a VM with Debian (without desktop) + Putty + xming is actually a really cool setup to test Linux executables. Also, it has the added benefict of adding a little bit of safety, since it runs in a separate system. If you install a malicious program or, in the worst case, a mirror gets hacked and distributes infected updates, it will only affect one machine in a different subnet (by default).
– Ismael Miguel
Sep 26 '18 at 1:49
7
@Bob the reason WINE can run in userspace and WSL must have kernel components is that on Linux syscalls are part of the ABI, whereas on Windows everything is virtualized via calls to functions in ntdll.dll
– kinokijuf
Sep 26 '18 at 7:47
|
show 1 more comment
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:
- Recompile the program on Windows to get a native executable
- Install the Windows Subsystem for Linux and run the program in that environment
- Install Linux in a virtual machine and run the program in that environment
- Install Cygwin or MinGW and recompile and run in that environment
- 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.
38
Depending on how you look at it, running under WSL is "native" under Windows, though not pre-installed by default.
– Bob
Sep 25 '18 at 8:14
13
@Bob In the same sense that running a Windows program under WINE is “native”.
– Socob
Sep 25 '18 at 12:21
17
@Socob Not quite: WSL is part of the NT kernel. But otherwise, yes Wine is as close as you'll get to running a Win32 binary natively on Linux.
– Bob
Sep 25 '18 at 13:17
1
Using a VM with Debian (without desktop) + Putty + xming is actually a really cool setup to test Linux executables. Also, it has the added benefict of adding a little bit of safety, since it runs in a separate system. If you install a malicious program or, in the worst case, a mirror gets hacked and distributes infected updates, it will only affect one machine in a different subnet (by default).
– Ismael Miguel
Sep 26 '18 at 1:49
7
@Bob the reason WINE can run in userspace and WSL must have kernel components is that on Linux syscalls are part of the ABI, whereas on Windows everything is virtualized via calls to functions in ntdll.dll
– kinokijuf
Sep 26 '18 at 7:47
|
show 1 more comment
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:
- Recompile the program on Windows to get a native executable
- Install the Windows Subsystem for Linux and run the program in that environment
- Install Linux in a virtual machine and run the program in that environment
- Install Cygwin or MinGW and recompile and run in that environment
- 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.
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:
- Recompile the program on Windows to get a native executable
- Install the Windows Subsystem for Linux and run the program in that environment
- Install Linux in a virtual machine and run the program in that environment
- Install Cygwin or MinGW and recompile and run in that environment
- 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.
edited Dec 23 '18 at 5:53
answered Sep 25 '18 at 0:57
KeltariKeltari
51k18118170
51k18118170
38
Depending on how you look at it, running under WSL is "native" under Windows, though not pre-installed by default.
– Bob
Sep 25 '18 at 8:14
13
@Bob In the same sense that running a Windows program under WINE is “native”.
– Socob
Sep 25 '18 at 12:21
17
@Socob Not quite: WSL is part of the NT kernel. But otherwise, yes Wine is as close as you'll get to running a Win32 binary natively on Linux.
– Bob
Sep 25 '18 at 13:17
1
Using a VM with Debian (without desktop) + Putty + xming is actually a really cool setup to test Linux executables. Also, it has the added benefict of adding a little bit of safety, since it runs in a separate system. If you install a malicious program or, in the worst case, a mirror gets hacked and distributes infected updates, it will only affect one machine in a different subnet (by default).
– Ismael Miguel
Sep 26 '18 at 1:49
7
@Bob the reason WINE can run in userspace and WSL must have kernel components is that on Linux syscalls are part of the ABI, whereas on Windows everything is virtualized via calls to functions in ntdll.dll
– kinokijuf
Sep 26 '18 at 7:47
|
show 1 more comment
38
Depending on how you look at it, running under WSL is "native" under Windows, though not pre-installed by default.
– Bob
Sep 25 '18 at 8:14
13
@Bob In the same sense that running a Windows program under WINE is “native”.
– Socob
Sep 25 '18 at 12:21
17
@Socob Not quite: WSL is part of the NT kernel. But otherwise, yes Wine is as close as you'll get to running a Win32 binary natively on Linux.
– Bob
Sep 25 '18 at 13:17
1
Using a VM with Debian (without desktop) + Putty + xming is actually a really cool setup to test Linux executables. Also, it has the added benefict of adding a little bit of safety, since it runs in a separate system. If you install a malicious program or, in the worst case, a mirror gets hacked and distributes infected updates, it will only affect one machine in a different subnet (by default).
– Ismael Miguel
Sep 26 '18 at 1:49
7
@Bob the reason WINE can run in userspace and WSL must have kernel components is that on Linux syscalls are part of the ABI, whereas on Windows everything is virtualized via calls to functions in ntdll.dll
– kinokijuf
Sep 26 '18 at 7:47
38
38
Depending on how you look at it, running under WSL is "native" under Windows, though not pre-installed by default.
– Bob
Sep 25 '18 at 8:14
Depending on how you look at it, running under WSL is "native" under Windows, though not pre-installed by default.
– Bob
Sep 25 '18 at 8:14
13
13
@Bob In the same sense that running a Windows program under WINE is “native”.
– Socob
Sep 25 '18 at 12:21
@Bob In the same sense that running a Windows program under WINE is “native”.
– Socob
Sep 25 '18 at 12:21
17
17
@Socob Not quite: WSL is part of the NT kernel. But otherwise, yes Wine is as close as you'll get to running a Win32 binary natively on Linux.
– Bob
Sep 25 '18 at 13:17
@Socob Not quite: WSL is part of the NT kernel. But otherwise, yes Wine is as close as you'll get to running a Win32 binary natively on Linux.
– Bob
Sep 25 '18 at 13:17
1
1
Using a VM with Debian (without desktop) + Putty + xming is actually a really cool setup to test Linux executables. Also, it has the added benefict of adding a little bit of safety, since it runs in a separate system. If you install a malicious program or, in the worst case, a mirror gets hacked and distributes infected updates, it will only affect one machine in a different subnet (by default).
– Ismael Miguel
Sep 26 '18 at 1:49
Using a VM with Debian (without desktop) + Putty + xming is actually a really cool setup to test Linux executables. Also, it has the added benefict of adding a little bit of safety, since it runs in a separate system. If you install a malicious program or, in the worst case, a mirror gets hacked and distributes infected updates, it will only affect one machine in a different subnet (by default).
– Ismael Miguel
Sep 26 '18 at 1:49
7
7
@Bob the reason WINE can run in userspace and WSL must have kernel components is that on Linux syscalls are part of the ABI, whereas on Windows everything is virtualized via calls to functions in ntdll.dll
– kinokijuf
Sep 26 '18 at 7:47
@Bob the reason WINE can run in userspace and WSL must have kernel components is that on Linux syscalls are part of the ABI, whereas on Windows everything is virtualized via calls to functions in ntdll.dll
– kinokijuf
Sep 26 '18 at 7:47
|
show 1 more comment
You need the Linux subsystem for Windows (WSL) and a Linux distribution. The Windows store has a few Linux distributions prepackaged with WSL. Ubuntu is fairly popular, but since you already have a Linux system on which you built a.out
, it might be easiest to match that.
If you can't match the Linux distributions, and a.out
doesn't work as-built, it's also possible to re-run make
on your WSL distribution
1
The SuSE version works quite well too.
– cup
Sep 26 '18 at 9:44
add a comment |
You need the Linux subsystem for Windows (WSL) and a Linux distribution. The Windows store has a few Linux distributions prepackaged with WSL. Ubuntu is fairly popular, but since you already have a Linux system on which you built a.out
, it might be easiest to match that.
If you can't match the Linux distributions, and a.out
doesn't work as-built, it's also possible to re-run make
on your WSL distribution
1
The SuSE version works quite well too.
– cup
Sep 26 '18 at 9:44
add a comment |
You need the Linux subsystem for Windows (WSL) and a Linux distribution. The Windows store has a few Linux distributions prepackaged with WSL. Ubuntu is fairly popular, but since you already have a Linux system on which you built a.out
, it might be easiest to match that.
If you can't match the Linux distributions, and a.out
doesn't work as-built, it's also possible to re-run make
on your WSL distribution
You need the Linux subsystem for Windows (WSL) and a Linux distribution. The Windows store has a few Linux distributions prepackaged with WSL. Ubuntu is fairly popular, but since you already have a Linux system on which you built a.out
, it might be easiest to match that.
If you can't match the Linux distributions, and a.out
doesn't work as-built, it's also possible to re-run make
on your WSL distribution
answered Sep 25 '18 at 9:15
MSaltersMSalters
7,34711725
7,34711725
1
The SuSE version works quite well too.
– cup
Sep 26 '18 at 9:44
add a comment |
1
The SuSE version works quite well too.
– cup
Sep 26 '18 at 9:44
1
1
The SuSE version works quite well too.
– cup
Sep 26 '18 at 9:44
The SuSE version works quite well too.
– cup
Sep 26 '18 at 9:44
add a comment |
The answer above covered most of the aspects, but not sure if have come across flinux (sometimes called foreign linux) which happens to have been also suggested here and may be an easier workaround depending on what you are trying to achieve.
(Note I have WSL and work with emulators and VMs a lot, and I haven't really explorer other workarounds :))
Foreign LINUX is a dynamic binary translator and a Linux system call
interface emulator for the Windows platform. It is capable of running
unmodified Linux binaries on Windows without any drivers or
modifications to the system. This provides another way of running
Linux applications under Windows in constrast to Cygwin and other
tools. It now runs a large bunch of console applications and some GUI
applications.
add a comment |
The answer above covered most of the aspects, but not sure if have come across flinux (sometimes called foreign linux) which happens to have been also suggested here and may be an easier workaround depending on what you are trying to achieve.
(Note I have WSL and work with emulators and VMs a lot, and I haven't really explorer other workarounds :))
Foreign LINUX is a dynamic binary translator and a Linux system call
interface emulator for the Windows platform. It is capable of running
unmodified Linux binaries on Windows without any drivers or
modifications to the system. This provides another way of running
Linux applications under Windows in constrast to Cygwin and other
tools. It now runs a large bunch of console applications and some GUI
applications.
add a comment |
The answer above covered most of the aspects, but not sure if have come across flinux (sometimes called foreign linux) which happens to have been also suggested here and may be an easier workaround depending on what you are trying to achieve.
(Note I have WSL and work with emulators and VMs a lot, and I haven't really explorer other workarounds :))
Foreign LINUX is a dynamic binary translator and a Linux system call
interface emulator for the Windows platform. It is capable of running
unmodified Linux binaries on Windows without any drivers or
modifications to the system. This provides another way of running
Linux applications under Windows in constrast to Cygwin and other
tools. It now runs a large bunch of console applications and some GUI
applications.
The answer above covered most of the aspects, but not sure if have come across flinux (sometimes called foreign linux) which happens to have been also suggested here and may be an easier workaround depending on what you are trying to achieve.
(Note I have WSL and work with emulators and VMs a lot, and I haven't really explorer other workarounds :))
Foreign LINUX is a dynamic binary translator and a Linux system call
interface emulator for the Windows platform. It is capable of running
unmodified Linux binaries on Windows without any drivers or
modifications to the system. This provides another way of running
Linux applications under Windows in constrast to Cygwin and other
tools. It now runs a large bunch of console applications and some GUI
applications.
answered Sep 25 '18 at 9:14
xavier_fakeratxavier_fakerat
1,8561421
1,8561421
add a comment |
add a comment |
You can cross compile for Windows on Linux.
See https://stackoverflow.com/questions/2033997/how-to-compile-for-windows-on-linux-with-gcc-g
This allows you to use Linux to compile a binary executable program that runs under Windows.
add a comment |
You can cross compile for Windows on Linux.
See https://stackoverflow.com/questions/2033997/how-to-compile-for-windows-on-linux-with-gcc-g
This allows you to use Linux to compile a binary executable program that runs under Windows.
add a comment |
You can cross compile for Windows on Linux.
See https://stackoverflow.com/questions/2033997/how-to-compile-for-windows-on-linux-with-gcc-g
This allows you to use Linux to compile a binary executable program that runs under Windows.
You can cross compile for Windows on Linux.
See https://stackoverflow.com/questions/2033997/how-to-compile-for-windows-on-linux-with-gcc-g
This allows you to use Linux to compile a binary executable program that runs under Windows.
answered Sep 25 '18 at 10:42
RedGrittyBrickRedGrittyBrick
66.7k12105160
66.7k12105160
add a comment |
add a comment |
Another option which is similar to running a Virtual machine, but not exactly the same is running your application from a Docker container.
Yes Docker for Windows uses a VM in the background (MobyLinuxVM on HyperV), but you can do something like this:
$ docker run a.out
and will stop the container on its own. It will also use less resources and the output can be read from Windows own terminals like cmd and PowerShell.
A dockerfile for this situation will look something like this:
FROM docker pull ubuntu:latest
RUN make -f mymakefile
I think personally this is the nicest solution for running Linux applications in Windows
add a comment |
Another option which is similar to running a Virtual machine, but not exactly the same is running your application from a Docker container.
Yes Docker for Windows uses a VM in the background (MobyLinuxVM on HyperV), but you can do something like this:
$ docker run a.out
and will stop the container on its own. It will also use less resources and the output can be read from Windows own terminals like cmd and PowerShell.
A dockerfile for this situation will look something like this:
FROM docker pull ubuntu:latest
RUN make -f mymakefile
I think personally this is the nicest solution for running Linux applications in Windows
add a comment |
Another option which is similar to running a Virtual machine, but not exactly the same is running your application from a Docker container.
Yes Docker for Windows uses a VM in the background (MobyLinuxVM on HyperV), but you can do something like this:
$ docker run a.out
and will stop the container on its own. It will also use less resources and the output can be read from Windows own terminals like cmd and PowerShell.
A dockerfile for this situation will look something like this:
FROM docker pull ubuntu:latest
RUN make -f mymakefile
I think personally this is the nicest solution for running Linux applications in Windows
Another option which is similar to running a Virtual machine, but not exactly the same is running your application from a Docker container.
Yes Docker for Windows uses a VM in the background (MobyLinuxVM on HyperV), but you can do something like this:
$ docker run a.out
and will stop the container on its own. It will also use less resources and the output can be read from Windows own terminals like cmd and PowerShell.
A dockerfile for this situation will look something like this:
FROM docker pull ubuntu:latest
RUN make -f mymakefile
I think personally this is the nicest solution for running Linux applications in Windows
answered Sep 27 '18 at 14:09
ThomasThomas
10612
10612
add a comment |
add a comment |
For this particular case I myself used to install gcc on my windows 8 by mingw.
Then I would add path of my mingw folder to system path (from control panel/system/advanced system settings).
Then I could run gcc on my command prompt just like linux.
add a comment |
For this particular case I myself used to install gcc on my windows 8 by mingw.
Then I would add path of my mingw folder to system path (from control panel/system/advanced system settings).
Then I could run gcc on my command prompt just like linux.
add a comment |
For this particular case I myself used to install gcc on my windows 8 by mingw.
Then I would add path of my mingw folder to system path (from control panel/system/advanced system settings).
Then I could run gcc on my command prompt just like linux.
For this particular case I myself used to install gcc on my windows 8 by mingw.
Then I would add path of my mingw folder to system path (from control panel/system/advanced system settings).
Then I could run gcc on my command prompt just like linux.
answered Sep 26 '18 at 18:25
Amin VakilAmin Vakil
1214
1214
add a comment |
add a comment |
Try to get the windows exe or msi equivalent of the linux executable and run or use cygwin to install linux executable.
There is a tool mobaxterm very helpful, have a look and you can get your task done. This tool has cygwin and other linux utility to proceed with.
Source: https://www.quora.com/How-do-I-run-Linux-executable-on-windows
4
MobaXterm appears to be a tool to access remote systems from a Windows system. It provides a terminal window (X server) and acts as ssh client. Therefore, it might help to develop and compile on a remote Unix system, but it has no cross compilation features.
– Axel Kemper
Sep 25 '18 at 9:38
9
There won't be an equivalent MSI or EXE because the OP is compiling the code themselves.
– selectstriker2
Sep 25 '18 at 14:35
2
@AxelKemper I used MobaXterm years ago. If I recall, what you describe was a main attraction, but it actually did more than that. I do not recall exactly how much more, and I am not sure if it could be used as this answer states, but there was indeed more to it than is apparent on the surface.
– Aaron
Sep 25 '18 at 22:18
2
The linked source from quora seems low quality and difficult to understand.
– Aaron
Sep 25 '18 at 22:20
4
@Aaron - It's also not quoted, so this answer, is not much more than a link only answer.
– Ramhound
Sep 25 '18 at 23:41
add a comment |
Try to get the windows exe or msi equivalent of the linux executable and run or use cygwin to install linux executable.
There is a tool mobaxterm very helpful, have a look and you can get your task done. This tool has cygwin and other linux utility to proceed with.
Source: https://www.quora.com/How-do-I-run-Linux-executable-on-windows
4
MobaXterm appears to be a tool to access remote systems from a Windows system. It provides a terminal window (X server) and acts as ssh client. Therefore, it might help to develop and compile on a remote Unix system, but it has no cross compilation features.
– Axel Kemper
Sep 25 '18 at 9:38
9
There won't be an equivalent MSI or EXE because the OP is compiling the code themselves.
– selectstriker2
Sep 25 '18 at 14:35
2
@AxelKemper I used MobaXterm years ago. If I recall, what you describe was a main attraction, but it actually did more than that. I do not recall exactly how much more, and I am not sure if it could be used as this answer states, but there was indeed more to it than is apparent on the surface.
– Aaron
Sep 25 '18 at 22:18
2
The linked source from quora seems low quality and difficult to understand.
– Aaron
Sep 25 '18 at 22:20
4
@Aaron - It's also not quoted, so this answer, is not much more than a link only answer.
– Ramhound
Sep 25 '18 at 23:41
add a comment |
Try to get the windows exe or msi equivalent of the linux executable and run or use cygwin to install linux executable.
There is a tool mobaxterm very helpful, have a look and you can get your task done. This tool has cygwin and other linux utility to proceed with.
Source: https://www.quora.com/How-do-I-run-Linux-executable-on-windows
Try to get the windows exe or msi equivalent of the linux executable and run or use cygwin to install linux executable.
There is a tool mobaxterm very helpful, have a look and you can get your task done. This tool has cygwin and other linux utility to proceed with.
Source: https://www.quora.com/How-do-I-run-Linux-executable-on-windows
answered Sep 25 '18 at 9:34
S.clorisS.cloris
801
801
4
MobaXterm appears to be a tool to access remote systems from a Windows system. It provides a terminal window (X server) and acts as ssh client. Therefore, it might help to develop and compile on a remote Unix system, but it has no cross compilation features.
– Axel Kemper
Sep 25 '18 at 9:38
9
There won't be an equivalent MSI or EXE because the OP is compiling the code themselves.
– selectstriker2
Sep 25 '18 at 14:35
2
@AxelKemper I used MobaXterm years ago. If I recall, what you describe was a main attraction, but it actually did more than that. I do not recall exactly how much more, and I am not sure if it could be used as this answer states, but there was indeed more to it than is apparent on the surface.
– Aaron
Sep 25 '18 at 22:18
2
The linked source from quora seems low quality and difficult to understand.
– Aaron
Sep 25 '18 at 22:20
4
@Aaron - It's also not quoted, so this answer, is not much more than a link only answer.
– Ramhound
Sep 25 '18 at 23:41
add a comment |
4
MobaXterm appears to be a tool to access remote systems from a Windows system. It provides a terminal window (X server) and acts as ssh client. Therefore, it might help to develop and compile on a remote Unix system, but it has no cross compilation features.
– Axel Kemper
Sep 25 '18 at 9:38
9
There won't be an equivalent MSI or EXE because the OP is compiling the code themselves.
– selectstriker2
Sep 25 '18 at 14:35
2
@AxelKemper I used MobaXterm years ago. If I recall, what you describe was a main attraction, but it actually did more than that. I do not recall exactly how much more, and I am not sure if it could be used as this answer states, but there was indeed more to it than is apparent on the surface.
– Aaron
Sep 25 '18 at 22:18
2
The linked source from quora seems low quality and difficult to understand.
– Aaron
Sep 25 '18 at 22:20
4
@Aaron - It's also not quoted, so this answer, is not much more than a link only answer.
– Ramhound
Sep 25 '18 at 23:41
4
4
MobaXterm appears to be a tool to access remote systems from a Windows system. It provides a terminal window (X server) and acts as ssh client. Therefore, it might help to develop and compile on a remote Unix system, but it has no cross compilation features.
– Axel Kemper
Sep 25 '18 at 9:38
MobaXterm appears to be a tool to access remote systems from a Windows system. It provides a terminal window (X server) and acts as ssh client. Therefore, it might help to develop and compile on a remote Unix system, but it has no cross compilation features.
– Axel Kemper
Sep 25 '18 at 9:38
9
9
There won't be an equivalent MSI or EXE because the OP is compiling the code themselves.
– selectstriker2
Sep 25 '18 at 14:35
There won't be an equivalent MSI or EXE because the OP is compiling the code themselves.
– selectstriker2
Sep 25 '18 at 14:35
2
2
@AxelKemper I used MobaXterm years ago. If I recall, what you describe was a main attraction, but it actually did more than that. I do not recall exactly how much more, and I am not sure if it could be used as this answer states, but there was indeed more to it than is apparent on the surface.
– Aaron
Sep 25 '18 at 22:18
@AxelKemper I used MobaXterm years ago. If I recall, what you describe was a main attraction, but it actually did more than that. I do not recall exactly how much more, and I am not sure if it could be used as this answer states, but there was indeed more to it than is apparent on the surface.
– Aaron
Sep 25 '18 at 22:18
2
2
The linked source from quora seems low quality and difficult to understand.
– Aaron
Sep 25 '18 at 22:20
The linked source from quora seems low quality and difficult to understand.
– Aaron
Sep 25 '18 at 22:20
4
4
@Aaron - It's also not quoted, so this answer, is not much more than a link only answer.
– Ramhound
Sep 25 '18 at 23:41
@Aaron - It's also not quoted, so this answer, is not much more than a link only answer.
– Ramhound
Sep 25 '18 at 23:41
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1361051%2fhow-do-i-make-windows-run-linux-executables%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
without ever doing this id think you would have to use a cross compiler
– Hayden Thring
Sep 25 '18 at 0:44
32
Since it's a C++ program, why don't you consider compiling and delivering the executable on a windows machine separately?
– Raju Devidas
Sep 25 '18 at 0:45
8
Can you explain what the C++ program does? If it's a command line program, then it would probably work if recompiled under the correct compiler on Windows (I presume GCC, but depends on the code). If it uses a GUI, then maybe it could compile on Windows, but maybe not. If it's some sort of daemon or device driver, then almost definitely, it won't compile on Windows.
– Neil
Sep 25 '18 at 7:43
3
Please do not cross post: stackoverflow.com/questions/52490846/…
– Greenonline
Sep 26 '18 at 14:22
2
@Greenonline Both that question and this one may have arisen from the same fundamental misunderstanding of the problems involved in sharing binary code across operating systems, but the actual questions being asked are very different. This is not a case of cross posting.
– jmbpiano
Sep 26 '18 at 19:22