public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mumit Khan <khan@xraylith.wisc.edu>
To: earnie_boyd@yahoo.com
Cc: Mumit Khan <khan@yahoo.com>, gw32 <gnu-win32@cygnus.com>
Subject: Re: BUG: egcs-1.1-mingw32 - gcc -o hello hello.C
Date: Thu, 15 Oct 1998 06:06:00 -0000	[thread overview]
Message-ID: <9810141928.AA11298@modi.xraylith.wisc.edu> (raw)
In-Reply-To: <19981014170027.19134.rocketmail@send1d.yahoomail.com>

Earnie Boyd <earnie_boyd@yahoo.com> writes:
> 
> According to the documentation for `gcc' in the `Overall Options' node
> I can use .C, .cxx, .cpp, or .cc to indicate that the code is C++. 
> The only step of the process that is incorrect is in the absence of
> the stdc++ library with the link command.  Also I can specify the
> switch `-x c++' which will also incorrectly not include the stdc++
> library.

You misunderstand the documentation. When the program called "gcc" sees a
.cpp, it calls the C++ compiler (note the difference between compiler and
driver), just as it calls the f77 compiler when it sees .[fF] extensions.

Linking is something altogether different, and linking stdc++ without
being told to automatically when using gcc is simply *wrong* (think 
binding to unneeded shared libraries, unnecessary static data, so on).

also, question of orthogonality.

  $ gcc -c foo.cc		<-- language can be deduced 
  $ gcc -o foo foo.cc		<-- language/runtime can be deduced 
  $ gcc -o foo foo.o		<-- language/runtime can not be deduced 

> Since the documentaion for gcc indicates that C++, as well as other
> dialects, is recognized upon file suffix then the appropriate
> libraries should be used or the documentation changed to indicate as
> you've suggested.

Compiling a language vs linking objects and hence providing the runtime 
required by those set of objects are treated differently in GCC (and
rightly so). 

I agree that the documentation should be clearer in this regard, and spell 
out that it's talking about *compiling* a language. This behaviour is not
likely to change however since it works and works very well.

Of course, I'm always curious as to why someone would want to use gcc to
compile/link C++ programs unless there is a special reason (I have some
for linking, but never for compiling).

Hope this clears it up.  Please see g++ faq for further info on this.

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

  reply	other threads:[~1998-10-15  6:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-15  6:06 Earnie Boyd
1998-10-15  6:06 ` Mumit Khan [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-10-14 10:16 Earnie Boyd
1998-10-14 10:41 ` Mumit Khan
1998-10-15 21:47   ` Charles Wilson
1998-10-15 21:47     ` Mumit Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9810141928.AA11298@modi.xraylith.wisc.edu \
    --to=khan@xraylith.wisc.edu \
    --cc=earnie_boyd@yahoo.com \
    --cc=gnu-win32@cygnus.com \
    --cc=khan@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).