Newbie problem with the String class

Jacek Wojdel wojdel at chrysler.kbs.twi.tudelft.nl
Wed Feb 9 14:31:12 GMT 2000


On Wed, 09 Feb 2000, you wrote:
>  #include <iostream>
>  #include <String>
>  
>  int main ()
>  {
>      String s = "Hello world";
>      return 0;
>  }
> 
> Building the project again produced said error messages:
> 
> > undefined reference to 'String::String(char const *)'
> > undefined reference to 'String::~String(void)'
> > undefined reference to 'String::~String(void)'
> 
> Any idea?

Are you sure that you link libg++ (-lg++) to your program ? That's a first
idea. The second one is to try adding:

#pragma implementation "String.h"

just before including <String> (this is explained in gcc info -> C++ Extensions
-> C++ Interface)
Unfortunately I can't check the latter one as on Solaris libg++ clashes with
libstdc++ (and using "-nostdlib -lc -lm -liostream -ldl" still didn't resolve
_IO_getc and _IO_putc, but it may be different on Linux box).

Regards,
	Jacek


-- 
+-------------------------------------+
|from: J.C.Wojdel                     |
|      J.C.Wojdel at cs.tudelft.nl       |
+-------------------------------------+




More information about the KDevelop mailing list