delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/26/12:36:23

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: Linking problem (undefined reference)
Date: Fri, 26 Mar 1999 06:31:30 -0700
Message-ID: <01be778c$f55d1ec0$LocalHost@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com

>I've created a new class called CSentence that has a list of
>string.

>list <string> m_Words;

is this a template?

>While linking, LD displays the following error message:
>d:/djgpp/tmp\ccdaaaaa(.text+0xe1c6):Sentence.cc: undefined reference to
`list<basic_string<char, string_char_traits<char> >
>::operator=(list<basic_string<char,
> string_char_traits<char> > > const &)'

>What's the possible problem? How can I track down the problem?

if you're using templates then, if you have the member functions defined
outside of the class, you must do something like this to EXPLICITY
instantiate the class:

#include "templateclass.h"
#include "templateclass.cc"

template class mytemplateclass<string>;

Otherwise no code will get generated for it.  This may also be the case if
you use -fno-implicit-templates to compile.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019