Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 741
Hugo Avatar asked Oct 18 '25 14:10

Hugo


1 Answers

Remove the <T> from the declaration:

template <typename T>
class LinkedList
{
like image 87
Adam Avatar answered Oct 20 '25 03:10

Adam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!