Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a linux executable file (binary) to windows exe file?

Is there any way to convert a Linux binary file to windows exe file? For example if in Linux create a very simple binary file like this:

echo "main(){int i; i=i+1;}" >> main.c

gcc main.c -o main

Is there any way to convert main binary file to a windows exe file?

like image 313
sMojtaba Mar Avatar asked Jan 18 '13 09:01

sMojtaba Mar


People also ask

Can you run a Linux binary on Windows?

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.

How do I run a Linux executable on Windows?

To run a Linux program on Windows, you have these options: Run the program as-is on the Windows Subsystem for Linux (WSL). In WSL your program executes directly on the machine hardware, not in a virtual machine.


1 Answers

You can not convert a linux executeable into a windows executeable. But you can compile the source with cross-compiler.

E.g: MinGw32

if you are in ubuntu:

sudo apt-get install mingw32
i586-mingw32msvc-cc main.c -o main.exe
like image 118
mstrewe Avatar answered Nov 03 '22 23:11

mstrewe