0

There is an unresolved external symbol in main.cpp when i try to call the insert function. I can’t find the reason why this is happening? Any help is appreciated.

main.cpp

```
#include "List.h"
int main()
{
LList<int> number;
number.Insert(1);
}
```

list.h

```
#include <iostream>
using namespace std;
template <class T>
class LList
{
private:
struct Node
{
T value;
struct Node *next;
};
Node *head;
public:
LList()
{head = NULL;}
void Insert(T);
void Delete(T);
void Display();
};
```

list.cpp

```
#include "List.h"
template <class T>
void LList<T>::Insert(T temp)
{
Node *newNode;
Node *nodePtr;
newNode = new Node;
newNode->value = temp;
newNode->next = NULL;
if(!head)
head = newNode;
else
{
nodePtr = head;
while(nodePtr->next)
nodePtr = nodePtr->next;
nodePtr->next = newNode;
}
}
template <class T>
void LList<T>::Display()
{
Node *nodePtr;
nodePtr = head;
while(nodePtr)
{
cout << nodePtr->value << endl;
nodePtr = nodePtr->next;
}
}
template <class T>
void LList<T>::Delete(T temp)
{
Node *nodePtr;
Node *previousNode;
if(!head)
return;
if(head->value == temp)
{
nodePtr = head->next;
delete head;
head = nodePtr;
}
else
{
nodePtr = head;
while(nodePtr != NULL && nodePtr->value != temp)
{
previousNode = nodePtr;
nodePtr = nodePtr->next;
}
if(nodePtr)
{
previousNode->next = nodePtr->next;
delete nodePtr;
}
}
}
```