Compiling error for templated class

I am compiling my code using g++ main.cpp LinkedList.cpp Node.cpp -o project

This is the error I am getting. I am unsure what it means.

/tmp/ccDE0c2e.o: In function 'LinkedList<int>addFront(int)':
main.cpp:(.text._ZN10LinkedListIiE8addFrontEi[_ZN10LinkedListIiE8addFrontEi]+0x28a): undefined reference to 'Node<int>::Node<int>'
main.cpp(.text._ZN10LinkedListIiE8addFrontEi[_ZN10LinkedListIiE8addFrontEi]+0x5a): undefined reference to 'Node<int>::setNext(Node<int>*)'
collect2: error: ld returned 1 exist status
It would appear that
either you have not defined Node<T>::Node and NodeT<>::setNext(Node<T>*)
or that their definitions are in the .cpp file

If it is the latter, move the definitions of the templated functions to the header file.
Topic archived. No new replies allowed.