C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with templates...

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Kostas Katsamakas
Guest





PostPosted: Sun Sep 28, 2003 11:41 pm    Post subject: Problem with templates... Reply with quote



I have created a template class with its implementation in a .cpp file
and its declaration in a .h
Compilation finishes successfully and i get errors during linking with
unresolved externals. The
reported externals are methods of the template class. If i put the
implementation of these methods
in the header file, after the declaration of the template class then
everything goes fine.
What could be wrong. I have the feeling that it could be something really
easy that i'm missing
at the moment.



Back to top
Kostas Katsamakas
Guest





PostPosted: Sun Sep 28, 2003 11:54 pm    Post subject: Re: Problem with templates... Reply with quote



i forgot to mention that i'm using Visual Studio 6.0



Back to top
David White
Guest





PostPosted: Mon Sep 29, 2003 12:24 am    Post subject: Re: Problem with templates... Reply with quote



Kostas Katsamakas <kmak (AT) csd (DOT) auth.gr> wrote

Quote:
I have created a template class with its implementation in a .cpp file
and its declaration in a .h
Compilation finishes successfully and i get errors during linking with
unresolved externals. The
reported externals are methods of the template class. If i put the
implementation of these methods
in the header file, after the declaration of the template class then
everything goes fine.

In the header is where they are supposed to be. The compiler can't compile
the implementations of the template class's member functions for different
template parameters unless it can see the source code for the functions at
all the places the template is used.

DW




Back to top
Kevin Goodsell
Guest





PostPosted: Mon Sep 29, 2003 12:24 am    Post subject: Re: Problem with templates... Reply with quote

Kostas Katsamakas wrote:

Quote:
I have created a template class with its implementation in a .cpp file
and its declaration in a .h
Compilation finishes successfully and i get errors during linking with
unresolved externals. The
reported externals are methods of the template class. If i put the
implementation of these methods
in the header file, after the declaration of the template class then
everything goes fine.
What could be wrong. I have the feeling that it could be something really
easy that i'm missing
at the moment.




http://www.parashift.com/c++-faq-lite/containers-and-templates.html#faq-34.12
http://www.parashift.com/c++-faq-lite/containers-and-templates.html#faq-34.14

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.