Node needs to be declared as Node<T> * Head; etc. |
Then i get these errors:
'T' was not declared in this scope
template argument 1 is invalid
By the way, i post all the errors i get, maybe that will help.
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:32: error: ISO C++ forbids declaration of 'Node' with no type
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:32: error: expected ';' before '*' token
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:43: error: 'Node' is not a type
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:43: error: 'Node' is not a type
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:49: error: 'Node' is not a type
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:56: error: 'Node' is not a type
/home/kane/Programs/C++/ChainedList/src/ChainedList.h: In constructor 'ChainedList::ChainedList()':
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:37: error: 'Head' was not declared in this scope
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:37: error: 'null' was not declared in this scope
/home/kane/Programs/C++/ChainedList/src/ChainedList.h: In member function 'void ChainedList::insertAfter(int&, int&)':
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:45: error: request for member 'Next' in 'newNode', which is of non-class type 'int'
make[2]: Nothing to be done for `all-am'.
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:45: error: request for member 'Next' in 'node', which is of non-class type 'int'
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:46: error: request for member 'Next' in 'node', which is of non-class type 'int'
/home/kane/Programs/C++/ChainedList/src/ChainedList.h: In member function 'void ChainedList::insertAfter(int&)':
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:51: error: request for member 'Next' in 'newNode', which is of non-class type 'int'
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:51: error: 'Head' was not declared in this scope
/home/kane/Programs/C++/ChainedList/src/ChainedList.h: In member function 'void ChainedList::removeAfter(int&)':
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:58: error: missing template arguments before '*' token
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:58: error: 'nodeBeingRemoved' was not declared in this scope
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:58: error: request for member 'Next' in 'node', which is of non-class type 'int'
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:59: error: request for member 'next' in 'node', which is of non-class type 'int'
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:59: error: request for member 'Next' in 'node', which is of non-class type 'int'
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:60: error: type '<type error>' argument given to 'delete', expected pointer
/home/kane/Programs/C++/ChainedList/src/ChainedList.h: In member function 'void ChainedList::removeAfter()':
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:65: error: missing template arguments before '*' token
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:65: error: 'nodeBeingRemoved' was not declared in this scope
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:65: error: 'Head' was not declared in this scope
/home/kane/Programs/C++/ChainedList/src/ChainedList.h:67: error: type '<type error>' argument given to 'delete', expected pointer
Note: where in these errors it says line x, its really line x - 20, because there is a huge comment at the beginning of each file, which i didn't post.