From: khan@xraylith.wisc.edu (Mumit Khan)
Subject: Re: BUG: egcs-1.1-mingw32 - gcc -o hello hello.C
15 Oct 1998 06:29:53 -0700
Message-ID: <Pine.SUN.3.93.981014110606.10933F-100000.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <19981014153400.13514.rocketmail@send104.yahoomail.com>
Reply-To: Mumit Khan <khan@xraylith.wisc.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: Earnie Boyd <earnie_boyd@yahoo.com>
Cc: gw32 <gnu-win32@cygnus.com>

On Wed, 14 Oct 1998, Earnie Boyd wrote:

> When giving this command with mingw32 version of egcs-1.1 the stdc++
> library isn't properly included at the execution of ld.  This is the
> only problem with this command.
> 
> g++ -o hello hello.C will properly add the library.
> 

Hi Earnie,

I'm a bit confused ... "gcc" is the C driver, and "g++" or "c++" is the 
C++ driver. "gcc" will not and should not C++ specific libraries, and the 
only correct and portable way to link C++ programs is to use the "c++" or 
"g++" driver. If "gcc" adds C++ specific libraries, it's a bug, not a 
feature.

Correct way to link C++ programs:

  $ c++ -o hello hello.cc

(or alternatively use g++, which is just a link to c++).

However, *knowing* how gcc works, we can use the C driver to link C++
programs:
  
  $ gcc -o hello hello.cc -lstdc++

Note that you probably should not use '.C' for C++ extension, but rather
something that works on all OS/filesystems (Unix, VMS, Win32), such .cc, 
..cxx, etc (I personally dislike the MS-advocated .cpp extension!).

Please let me know if I'm misinterpreting your note.

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".
