delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/24/09:59:16

Message-ID: <3812BF6D.5AE52A76@hjc.edu.sg>
Date: Sun, 24 Oct 1999 16:12:29 +0800
From: Chong Kai Xiong <8111883c AT hjc DOT edu DOT sg>
X-Mailer: Mozilla 4.04 [en]C-NECCK (Win95; I)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Templates
References: <199910141426 DOT HAA13972 AT www1 DOT xoommail DOT com>
Reply-To: djgpp AT delorie DOT com


Rithe wrote:

> Ok, here we go.  The error message that I get is at run time.  There are
> a number of errors, and all are pretty much the same.  One is: Error:
> undefined reference to 'List<int>::List(void)'  My whole list class is
> template, so it should work.  Am I just missing something somewhere?
>
> Brian Ronk
>
> Davin McCall et.al. wrote:
>  > That's more than a little vague. Maybe you could post the source,
>  > along with the *exact* wording of the error message.
>  >
>  > Also, you say that it compiles fine ... does that mean that you are
>  > getting the message at run time (ie when you actually run your
>  > program)?
>  >
>  > Davin.
>  >
>  >
>  > On Mon, 11 Oct 1999 16:56:14 -0700, Rithe <rithe AT xoommail DOT com> wrote:
>  >
>  > >I was working on a template, and found that it
>  > >isn't working right.  It is a List.  The error I
>  > >get is something like:
>  > >Cannot find List<int>, etc
>  > >I hope you know what I mean.  Everything compiles
>  > >fine, so I know that it is semi right.  I'm just
>  > >not sure why it is giving those errors when it is
>  > >a template.  Any ideas?
>  > >
>  > >Brian Ronk
>  >

Erm...I had this problem...I'm not sure if you're having the same one as
mine but anyway, did you definte the template class in a header file and
implemented it in separate C++ file? It compiles fine but DJGPP refuses to
link it...

To solve the problem I simply dump the implementation of  the class in the
same header file where I defined it...try that, hope it helps...

Kai

- Raw text -


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