I am making a templated class for a linked list in Visual C++ 6.0. Everything works fine until I put the static keyword in front of "int length;" I get the following error "error LNK2001: unresolved external symbol "private: static int LList<int>::length" (?length@?$LList@H@@0HA)"
I have a feeling that it is the templating that is causing the problem because there is an example in the MSDN help files for the static keyword that does exactly this except the class isn't templated. However, I have no idea why this error is occuring.
The following is the class interface(comments stripped):
void addItem(T item);
int removeItem(T item);
bool proveItem(T item);
T findItemByPos(int pos);
void editItem(T item, T newItem);
void editItemByPos(int pos, T newItem);
static int length; //<--Here is the problem
Anyone know why this is happening?