delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/26/16:36:46

From: axlq AT unicorn DOT us DOT com (axlq.comp.os.msdos.djgpp)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Didn't get what I want.
Date: 26 Jan 2000 19:48:04 GMT
Organization: a2i network
Lines: 30
Message-ID: <86nj1k$dtk$1@samba.rahul.net>
References: <388F4D7F DOT 3DFA AT ix DOT netcom DOT com>
NNTP-Posting-Host: yellow.rahul.net
NNTP-Posting-User: unicorn
X-Newsreader: trn 4.0-test70 (17 January 1999)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

[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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019