Linker error for an undefined reference to a constructor
Im writing a basic program for an animal guessing game (similar to twenty questions) using a binary search tree. The project consists of a lot of header files, so things are bound to get messy. But this is one error I haven't been able to figure out.
Error: [Linker error] undefined reference to `Node<QA>::Node(QA)'
Here's the function I've narrowed the problem down to:
...And the seperate .cpp file for the Node class (it's friended to QATree).
bool QATree::insert(string o, bool q)
Node<QA>* newnode = new Node<QA>(QA(o,q)); // this constructor function call causes the error.
root = newnode;
if (insert(root, newnode));
If you have any questions, or can't see the error here and would like to see more code, I'll be glad to help you help me.
template <typename T>
data = s;
left = NULL;
right = NULL;