I have no idea why this isn''t working, since I have done something like it before, but each time I try to access a static member, i get the following link error:
quote:error LNK2001: unresolved external symbol "public: static long CFraction::MaxNumerator" (?MaxNumerator@CFraction@@1JA)
Here is a stripped down version of the class I am using. It is defined in a header file.
class CFraction
{
protected:
long Numerator;
long Denominator;
public:
CFraction() { Numerator=Denominator=1;}
static long MaxNumerator;
static long MaxDenominator;
};
Now, in my main cpp file I try and set the static member MaxNumerator using the following code:
long CFraction::MaxNumerator = 10L;
And, as aforementioned, I get a linker error. Any ideas?