# C++ undefined reference for c++ template class method

I am trying to write a LinkedList class that leverage c++ templates.

Ideally I was hoping to be able to achieve something like an std::vector...

```
vector<int> nums;
nums.push_back(4);
vector<string> words;
words.push_back("blah");
```

I have implemented my LinkedList class, but when I try to call the methods, I get an undefined reference error...

/home/user/src/c++/main.cpp:158: undefined reference to `LinkedList::Add(int)'

My LinkedList class is as follows....

```
template<typename T>
struct Node {
T value;
Node* next;
Node(T _value) : value(_value) , next(nullptr) {}
};
template<typename T>
class LinkedList {
public:
public:
LinkedList() : m_root(nullptr) {}
void Add(T value);
std::string ToString() const;
public:
Node<T>* m_root;
};
```

cpp

```
#include "LinkedList.h"
#include <iostream>
#include <sstream>
template<class T>
void LinkedList<T>::Add (T value)
{
Node<T>* newNode = new Node<T>(value);
if (m_root == nullptr) {
m_root = newNode;
return;
}
Node<T>* endNode = m_root;
while (endNode->next != nullptr)
endNode = endNode->next;
endNode->next = newNode;
}
template<class T>
std::string LinkedList<T>::ToString () const
{
std::stringstream ss;
Node<T>* node = m_root;
while (node != nullptr) {
ss << node->value;
ss << ' ';
node = node->next;
}
ss << '\n';
return ss.str();
}
```