Hugo
Hugo

Reputation: 2444

error: class is not a template

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?

Upvotes: 4

Views: 13700

Answers (1)

Adam
Adam

Reputation: 17329

Remove the <T> from the declaration:

template <typename T>
class LinkedList
{

Upvotes: 14

Related Questions