Newbie string link error

s bing-wo sbingwo@interlog.com
Mon Jan 26 16:35:00 GMT 1998


I have just tried to get egcs 1.0.1 running on a Redhat 5.0 Linux
system (i386) and have been able to compile the kernel (2.0.33 and
2.1.81) ok. Now I'm playing around with c++ and get a strange link 
error when I try and use the standard string class:

#include <iostream.h>
#include <string>
using namespace std;
int main()
{
    string s("hello world");
    // cout << s << endl;
    return 0;
}

A link error is produced something like:
.... In function basic_string<char, string_char_traits<char>
>::Rep::grab(void):
[and in Rep::gnu.linkonce.t.grab]
undefined reference to basic_string< ... >::Rep::clone(void)

Putting -lstdc++ in the link line doesn't seem to make any difference.
Can anyone enlighten me?

Doug Gilbert




More information about the Gcc-bugs mailing list