what's up with static members?
Hi to all of you. :)
I'm trying to use a static variable in my class which is defined in a header file. The problem is that the linker won't let me do it like this:
Code:
Error: Unresolved external 'Cell::Parent' referenced from C:\C++\NETWORK\NNMAIN.OBJ
The class is something like this:
Code:
// file: nnetwork.h
class Cell {
private:
static another_class* Parent;
//stuff...
public:
SetParent(another_class*);
//stuff...
};
which is #included in nnmain.cpp
Code:
// file: nnmain.cpp
#include "nnetwork.h"
I would like to know the right way to link many source files into a single executable (no dlls). Maybe i should also know the way to separate the source correctly, because this is not the first time i get this kind of errors (also when using extern) and i don't know how to solve it.
Thanks ;)