C++ does not name a type
<p>creating some old data structures in C++. Currently I am having an issue with a doubly-linked list class:</p>

<p>List.h:</p>

<pre><code>template &lt;class T&gt;
class List{

private:

int size;

struct listNode{                        
    T data;
    listNode* next;
    listNode* prev;
    listNode(T newData);
};

listNode * head;                    
listNode * tail;                    
listNode * curr;                    
listNode * find(listNode * place, int k);   
void removeCurrent(listNode * temp);    
public:

List(); 
int getSize() const;                
void insert(int loc, T data);       
void remove(int loc);           
T const &amp; getItem(int loc) const;   
void print();
</code></pre>

<p>};</p>

<p>List.cpp:</p>

<pre><code>#include "List.h"
#include &lt;iostream&gt;

using namespace std;

template&lt;class T&gt;
List&lt;T&gt;::List(){
size = 0;
head-&gt;next = tail;
head-&gt;prev = NULL;
tail-&gt;prev = head;
tail-&gt;next = NULL;


 }

// getSize: public method that returns the size of the list
template&lt;class T&gt;
int List&lt;T&gt;::getSize() const {
    return size;
}

// insert: public method that inserts data into the list
template&lt;class T&gt;
void List&lt;T&gt;::insert(int loc, T data){
    if(loc &lt;1){
        cout&lt;&lt;"Invalid Location"&lt;&lt;endl;
        return;
    }
    curr = find(head,loc-1);
    listNode * newNode = new listNode(data);
    newNode-&gt;next = curr-&gt;next;
    newNode-&gt;prev = curr;
    newNode-&gt;next-&gt;prev = newNode;
    curr-&gt;next = newNode;
    size++;
}

// remove: public method that inserts data into the list
template&lt;class T&gt;
void List&lt;T&gt;::remove(int loc){
    if(loc &lt;1){
        cout&lt;&lt;"Invalid Location"&lt;&lt;endl;
        return;
    }
    curr = find(head,loc);  // Find the node infront of the target
    removeCurrent(curr);    // Remove that node
}

// removeCurrent: helper function that removes the current node
template&lt;class T&gt;
void List&lt;T&gt;::removeCurrent(listNode* temp){
    listNode* t = temp-&gt;next;
    temp-&gt;data = t-&gt;data;       // HACK: take data from next node
    temp-&gt;next = t-&gt;next;
    t-&gt;next-&gt;prev = temp;
    delete t;
    t=NULL;
    size--;
}

// find: private helper function that returns a pointer to the k-1 node
template&lt;class T&gt;
listNode * List&lt;T&gt;::find(listNode * place, int k){
    if((k==0) || (place==NULL))
        return place;
    else return find(place-&gt;next,k-1);
}

// getItem: returns data at location loc
template&lt;class T&gt;
T const&amp; List&lt;T&gt;::getItem(int loc) const{
    curr = find(head,loc);
    return curr-&gt;data;
}

// print: prints the sequence of variables in the list
template&lt;class T&gt;
void List&lt;T&gt;::print()
{
    curr = head;
    while(curr-&gt;next != tail){
        curr = curr-&gt;next;
        cout&lt;&lt;curr-&gt;data&lt;&lt;endl;
    }
}

//listNode constructor
template&lt;class T&gt;
List&lt;T&gt;::listNode::listNode(T newdata):data(newdata),next(NULL),prev(NULL)
{}
</code></pre>

<p>The error I'm getting is the following: </p>

<blockquote>
  <p>error: 'listNode' does not name a type.</p>
</blockquote>

<p>I have tried different suggestions offered in similar troubleshooting posts, but I'm still getting this error. I have a main.cpp that includes List.cpp, but it's practically empty.</p>
