Date: Sun, 23 Mar 1997 14:28:25 +0300 (IDT) From: Eli Zaretskii 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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).