delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/23/06:40:00

Date: Sun, 23 Mar 1997 14:28:25 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: nitehawk91 AT aol DOT com
cc: djgpp AT delorie DOT com
Subject: Re: DJGPP C++ Compile problems...
In-Reply-To: <19970319202100.PAA11261@ladder01.news.aol.com>
Message-ID: <Pine.SUN.3.91.970323142801.29590C-100000@is>
MIME-Version: 1.0

On 19 Mar 1997 nitehawk91 AT aol DOT com wrote:

> > In particular, when linking C++ programs, it recommends using
> > gxx instead of gcc, because gxx searches all the relevant C++
> > libraries (-lgpp is only one of them) and will prevent you from
> > getting error messages from the linker saying that it didn't find some
> > functions.
> 
> I thought gcc automatically links a program with gxx if the file
> name suffix is .cc or .cpp ?  Shouldn't that include the neccesarry
> C++ librarys ? Please tell me if I'm wrong !

You are wrong.  Gcc automatically *compiles* a program as C++ if it
has a .cc or .cpp extension, by calling the C++ compiler (cc1plus.exe)
instead of the C compiler (cc1.exe).  But it doesn't automatically add
the C++ class libraries to the *linker* command line, because it
doesn't have any way of knowing which libraries does your program
need.  You can write a C++ program that only uses its own classes; or
you could install some alternative, non-GNU class libraries.  Gcc lets
you name the libraries you want.  Gxx makes this easier in simple
cases (by naming all the C++ libraries from libg++ package).

- Raw text -


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