error: class is not a template

Hugo picture Hugo · Oct 1, 2013 · Viewed 10.6k times · Source

I have the following class:

#include "SingleNode.h"

template <typename T>
class LinkedList<T>
{
    private:
        SingleNode<T>* head;
        SingleNode<T>* tail;
        SingleNode<T>* current;
        int currentSize;

    public:
        LinkedList();
        ~LinkedList();
};

As far as I can tell there isn't anything wrong with it. However, the compiler is giving me the following:

error: 'LinkedList' is not a template

Why isn't the compiler recognizing it as a template?

Answer

Adam picture Adam · Oct 1, 2013

Remove the <T> from the declaration:

template <typename T>
class LinkedList
{