Page 2 of 2

Re:To make .exes in linux

Posted: Tue Nov 08, 2005 9:48 pm
by me
Just wanted to let you know that mingw is gcc ported to windows. So it will be a cross compiler. So find out where the linux executable is and run it on a file as you would with gcc. And, by some type of magic, you will have an a.exe file which can run on windows. ( I think the default output is a.exe)

Re:To make .exes in linux

Posted: Fri Nov 25, 2005 8:08 am
by Pype.Clicker
OSMAN wrote: $ gcc -c hello.c
produce hello.exe as they say at mingw.org?
I don't think so; it's a.out.
hum ... straight from "man gcc" ...
-c Compile or assemble the source files, but do not link.
The linking stage simply is not done. The ultimate
output is in the form of an object file for each
source file.

By default, the object file name for a source file is
made by replacing the suffix .c, .i, .s, etc., with
.o.
and a bit later ...
-o file
Place output in file file. This applies regardless to
whatever sort of output is being produced, whether it
be an executable file, an object file, an assembler
file or preprocessed C code.

Since only one output file can be specified, it does
not make sense to use -o when compiling more than one
input file, unless you are producing an executable
file as output.

If -o is not specified, the default is to put an exe?
cutable file in a.out, the object file for source.suf?
fix in source.o, its assembler file in source.s, and
all preprocessed C source on standard output.
These are both detailed into "overall options" ...

Meaning if your gcc is correctly installed to produce the expected output format,

Code: Select all

cross-compiled-gcc -Wall -g -o hello.exe hello.c