This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help with templates


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







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]