Witam. Przy implementowaniu listy powiązanej dostałem 2 error'y (VS 2010):
test.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Node<int>::~Node<int>(void)" (??1?$Node@H@@UAE@XZ) referenced in function __unwindfunclet$??0?$LinkedList@H@@QAE@XZ$0
test.obj : error LNK2019: unresolved external symbol "public: __thiscall Node<int>::Node<int>(void)" (??0?$Node@H@@QAE@XZ) referenced in function "public: __thiscall LinkedList<int>::LinkedList<int>(void)" (??0?$LinkedList@H@@QAE@XZ)
Szukałem w necie i znalazłem coś o nagłówkach, ale dokładnie nie wiem co mam z tym zrobić, deklaracje dać do oddzielnego nagłówka? Uproszczony kod:
template <class T>
class Node
{
public:
Node();
virtual ~Node();
virtual Node* Insert(T* data) = 0;
};
template <class T>
class LinkedList : public Node<T>
{
private:
Node* next;
public:
LinkedList() {}
virtual ~LinkedList() {}
virtual Node* Insert(T* data) {}
};
template <class T>
class InternalNode : public Node<T>
{
private:
T* data;
Node* next;
public:
InternalNode(T* data, Node* next) {}
virtual ~InternalNode() {}
virtual Node* Insert(T* data) {}
};
template <class T>
class TailNode : public Node<T>
{
public:
virtual Node* Insert(T* data) {}
};
Oczywiście w klamrach są definicje metod, całość mam w głównym .cpp