4
Hi, I was wondering how can I compile a C code on Ubuntu and what
execute on Windows. I tried to put the extension ". exe" at the end
of the file, but when I sent the executable to my teacher he said
that did not spin.
4
Hi, I was wondering how can I compile a C code on Ubuntu and what
execute on Windows. I tried to put the extension ". exe" at the end
of the file, but when I sent the executable to my teacher he said
that did not spin.
7
You can create executables for windows using mingw-W64. By typing the following command, we can see the list of available packages:
apt-cache search mingw-
Among them:
mingw-w64 - Development environment targeting 32- and 64-bit Windows
After installing it:
sudo apt-get install mingw-w64
I created my executable (32 bits) from the folder
/usr/bin
, thus:
sudo i686-w64-mingw32-gcc-win32 helloworld.c -o helloworld.exe
For 64 bits:
sudo x86_64-w64-mingw32-gcc helloworld.c -o helloworld64.exe
Upshot:
Sources:
How to install mingw32 on Ubuntu?
How to Compile for Windows on Linux with gcc/g++?
Compile 64-bit Binary with Mingw (Dev-C++)
Browser other questions tagged windows ubuntu compilation gcc
You are not signed in. Login or sign up in order to post.
I do not know how to evaluate for sure, but I believe that this question is outside the scope of the site, anyway, take a look at How to program for Windows in Ubuntu.
– mateusalxd
Matthew, thank you for warning =D
– Otavio Augusto