From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: linker problem w/ class String Date: Sat, 02 May 1998 13:57:30 -0400 Organization: Two pounds of chaos and a pinch of salt. Lines: 31 Message-ID: <354B5E8A.22F8@cs.com> References: <354c562b DOT 14964878 AT news DOT kfunigraz DOT ac DOT at> NNTP-Posting-Host: ppp135.cs.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk mimo wrote: > > Error: test.o: In function `__tcf_0': > Error: test.cc(.text+0x1f): undefined reference to > `String::~String(void)' > Error: test.o: In function `main': > Error: test.cc(.text+0x49): undefined reference to > `String::String(char const *)' > test.cc(2) Error: undefined reference to `operator<<(ostream &, String > const &)' That's very interesting. No matter what I did, I was unable to reproduce your exact results, although I saw plenty of slightly different errors. Perhaps it's because I'm using gcc 2.8.0 and you're still using 2.7.2.1. In any case, the solution is simple: you must link all required C++ libraries when you compile. To use the String class, you have to link with both -lstdcxx and -lgpp. You have two other problems in your code: in order to use cout, you should #include (even though it is included already by <_string.h>), and void is not a legal return type for main(). -- John M. Aldrich, aka Fighteer I UIN# 7406319 -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---) O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++ e(*)>++++ h!() !r !y+() ------END GEEK CODE BLOCK------