Mail Archives: cygwin/1998/10/15/17:33:44
---Mumit Khan <khan AT xraylith DOT wisc DOT edu> wrote:
>
> 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.
>
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.
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.
==
- \\||//
-----------o0O0--Earnie--0O0o------------
-- earnie_boyd AT yahoo DOT com --
-- http://freeyellow.com/members5/gw32 --
--------------ooo0O--O0ooo---------------
PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -