| View previous topic :: View next topic |
| Author |
Message |
Kostas Katsamakas Guest
|
Posted: Sun Sep 28, 2003 11:41 pm Post subject: Problem with templates... |
|
|
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
|
Posted: Sun Sep 28, 2003 11:54 pm Post subject: Re: Problem with templates... |
|
|
i forgot to mention that i'm using Visual Studio 6.0
|
|
| Back to top |
|
 |
David White Guest
|
Posted: Mon Sep 29, 2003 12:24 am Post subject: Re: Problem with templates... |
|
|
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
|
Posted: Mon Sep 29, 2003 12:24 am Post subject: Re: Problem with templates... |
|
|
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 |
|
 |
|