www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/11/04:45:10

Message-ID: <19991011052444.76643.qmail@hotmail.com>
X-Originating-IP: [203.197.188.79]
From: "sundaresh venugopal" <vsundaresh AT hotmail DOT com>
To: djgpp AT delorie DOT com
Subject: Re: More template problems (C++)
Date: Sun, 10 Oct 1999 22:24:43 PDT
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

The scope qualifier for Replace() is missing.Try this slightly modified 
code, and see if it works.


Here is
>my code:
>
>*** foo.h
>template<class Etype>
>class Foo
>{
>public:
>   void Replace();
>};
>
>
>***foo.C
>#include "foo.h"
>
template<class Etype> void Foo<Etype>::Replace()
{}
>
>***main.C
>#include "foo.h"
>
>main()
>{
>   Foo<int> hi;
>   hi.Replace();
>}
>
>
>And I get the error on the compilation of the executable:
>:main.C: undefined reference to `Foo<int>::Replace(void)'
>
>Now, my question is what SPECIFICALLY would I need to change to make gpp
>compile it properly? In otherwords, how would I have to re-write the code 
>to
>make it work? Please be as speciffic as possible.
>
>Thanks again,
>Al Combs

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

- Raw text -


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