Mail Archives: djgpp/1997/03/23/06:40:00
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 -