Help with templates

Ricardo Santos rs@isctem.com
Fri Aug 13 11:46:00 GMT 2004


Thanks Eljay.

Yes, my main is located in mStackAr.cpp.

I solved the problem creating an Instancialization file, that only have 
the folowing lines:

#include "StackAr.cpp"
template class StackAr<int>;

But why do I have to include a .cpp? Cpp's aren't linked??? I am a C 
guy, that's a little confusing.

Ricardo

Eljay Love-Jensen wrote:

>Hi Ricardo,
>
>It looks like the main function does not have access to the template
>declaration.
>
>Is your template declaration in your StackAr.cpp?  Then you'll need #include
>"StackAr.cpp" for your main, presuming main is located in mStackAr.cpp.
>
>Or vice-versa, if I have StackAr.cpp and mStackAr.cpp reversed.
>
>HTH,
>--Eljay
>
>
>
>  
>



More information about the Gcc-help mailing list