Mail Archives: djgpp/2000/01/26/16:36:46
[posted and e-mailed]
In article <388F4D7F DOT 3DFA AT ix DOT netcom DOT com>, <ebfalcon AT ix DOT netcom DOT com> wrote:
>I type in gcc -c -Wall filename.cc.
>After compiling the c++ source file it creats a "o" file rather than an
>"exe". What happened and how can I get an exe file?
Remove the -c option. -Wall is your friend, leave it in. It causes
all warnings about syntax and programming style to be displayed.
The -c option tells the compiler to compile only, not link. In
other words, the -c tells the compiler to produce only an object
file for linking later. This is useful when you have a whole bunch
of source modules to compile and later combine (link) into one big
executable.
If you want to make an executable from a single stand-alone source
module, use this:
gcc -Wall filename.cc -o filename.exe
If you don't specify the output filename with -o then you'll get a
file called a.out which you'll have to rename. Gcc came from unix,
and that's what unix does.
When learning a compiler, it's a good idea to study the
documentation to find out what all the commandline options are. For
gcc, this documentation is long, but the effort is worthwhile.
-A
- Raw text -