I'm just getting started writing templated code, so I apologize if this is a very silly or elementary problem.
I'm trying to write a class which will essentially be able to store and return data of a specified type, along with a few other bits of information about it. My code seems to compile, but the linker complains and won't let me actually execute the code.
I've attached the .h and .cpp in one concatenated file to this post. If main() has this in it:
Attribute<int> myAttr;
myAttr.setData(3);
cout << myAttr.getData();
I get this error when linking:
ld: Undefined symbols:
Attribute<int>::getData()
Attribute<int>::setData(int)
Attribute<int>::Attribute[in-charge]()
Attribute<int>::~Attribute [in-charge]()
Any ideas on where I'm going wrong? I've looked through several tutorials and tried to mimic that code as closely as possible.
Thanks in advance!



LinkBack URL
About LinkBacks


