Compiler is saying that passed through variable is undeclared
<p>I'm having a small problem concerning two functions of mine. My compiler keeps on saying that the passed through functions are undeclared. Heres what the compiler says: </p>

<pre><code>LinkedList.hpp: In member function 'void LinkedList&lt;T&gt;::insert(int, T) [with T = std::basic_string&lt;char&gt;]':
test.cpp:92:1:   instantiated from here
LinkedList.hpp:96:2: error: 'struct ListNode&lt;std::basic_string&lt;char&gt; &gt;' has no member named 'item'
In file included from test.cpp:4:0:
LinkedList.hpp: In member function 'T LinkedList&lt;T&gt;::remove(int) [with T = std::basic_string&lt;char&gt;]':
test.cpp:92:1:   instantiated from here
LinkedList.hpp:139:2: error: 'struct ListNode&lt;std::basic_string&lt;char&gt; &gt;' has no member named 'theData'
</code></pre>

<p>Before I had the struct inside my class but that would not work. Why is it giving me these errors. </p>

<p>Now here is the code:</p>

<pre><code>#ifndef _CS235_LINKEDLIST_H_
#define _CS235_LINKEDLIST_H_
#define LIST_MAX 10


#include "ABCList.hpp"
#include&lt;iostream&gt;
using namespace std;

template &lt;class T&gt;
struct ListNode
    {
        T data; // List item
        ListNode *next; //Pointer to next node
    };

template &lt;class T&gt;
class LinkedList : public ABCList&lt;T&gt; {
private:

    int  size;
    ListNode&lt;T&gt; *head;
    ListNode&lt;T&gt; *find(int pos);
public:
    LinkedList();
    LinkedList(LinkedList &amp;other);
    virtual ~LinkedList();


    virtual bool isEmpty ();
    virtual int  getLength ();
    virtual void insert (int pos, T item);
    virtual T    remove (int pos);
    virtual T    retrieve (int pos);
};

template &lt;class T&gt;
LinkedList&lt;T&gt;::LinkedList() //Default constructor
{
    size = 0;
    head = NULL;
}

template &lt;class T&gt;
LinkedList&lt;T&gt;::LinkedList(LinkedList &amp;other) //Copy Constructor
{
    for(int i = 1; i &lt; other.getLength(); i++)
        insert(i, other.retrieve(i));
}

template &lt;class T&gt;//Deconstructor
LinkedList&lt;T&gt;::~LinkedList()
{
    while(!isEmpty ())
        remove(1);
}

template &lt;class T&gt;
ListNode&lt;T&gt;* LinkedList&lt;T&gt;::find(int pos) //Finds the position of an item
{
    if(pos &lt; 1)
        return NULL; //If pos is less than one then find returns NULL because pos is a illegal value.
    else
    {
        ListNode&lt;T&gt;* temp = head;
        for(int i = 1; i &lt; pos; i++)
            {temp = temp -&gt; next;}

        return temp;
    } 
}

template &lt;class T&gt;
bool LinkedList&lt;T&gt;::isEmpty ()//Function checks wheter if the list is empty
{
    if (size == 0)
        return true;
    return false;
}

template &lt;class T&gt;
int LinkedList&lt;T&gt;::getLength () //Function that returns size.
{
    return size;
}

template &lt;class T&gt;
void LinkedList&lt;T&gt;::insert (int pos, T item)// This function inserts a item.
{
    ListNode&lt;T&gt;* curr = new ListNode&lt;T&gt;(); //ListNode is inserted into the newly created node 
    curr -&gt; item = item;
    if(pos ==1) 
    { //Node is added to the beginning
        curr -&gt; next = head;
        head = curr;
    }
    else
    {
        ListNode&lt;T&gt;* prev = find(pos - 1);// A new node is placed after prev
        curr -&gt; next = prev;
        prev -&gt; next = curr;
        ++size;
    }
}

template &lt;class T&gt;  
T LinkedList&lt;T&gt;::remove (int pos)// This function deletes an item
{
    try
    {
        if(pos &lt; 1 || pos &gt; getLength()+1)// if the position of the list is one or greater than the list, it will throw an error.
            throw 99;
    }
    catch (int x)
        {cout &lt;&lt; "Error Number: " &lt;&lt; x;}

    T theData;
    ListNode&lt;T&gt;* curr = head;

    if(pos == 1) //The first node from the list is deleted.
    {
        curr = head; // This saves a pointer to node because when an item in the first position is deleted, a pointer is needed to precede it.
        head = head -&gt; next;
    }

    else 
    {
        ListNode&lt;T&gt;* prev = find(pos - 1);//This node will be deleted after the node that prev points to
        curr = prev -&gt; next; // The node is saved to a pointer
        prev -&gt; next = curr -&gt; next;
    }

    --size;
    theData = curr -&gt; theData;
    delete curr;
    return theData;
}

template &lt;class T&gt;
T LinkedList&lt;T&gt;:: retrieve (int pos)
{
    try
    {
        if(pos &lt; 1)// If the position is less than one an error will occur.
            throw 99;
    }
    catch (int x)
        {cout &lt;&lt; "Error. Error Number: " &lt;&lt; x;}

    if (pos &gt;= 1)
    {
        ListNode&lt;T&gt;* curr = find(pos);  
        return curr-&gt; data; //returns data to a node.
    }
}
#endif
</code></pre>
