Mail Archives: djgpp/1993/05/29/12:57:51
>Hi,
[stuff deleted]
>>x.o: Undefined symbol __5thing$i referenced from text segment
>>It seems fairly obvious that gcc hasnt allocated the data
>>object, so what do I have to do to make it work?
Correct. All you've done in the class declaration is specify that
somewhere there is a static variable that belongs to the class.
YOU have to instantiate that member variable in your class implementation
file (or at least somewhere):
// header file
class A
{
private:
static int m_nCount;
public:
// other members and whatnot
};
------------
// CPP implementation file
int A::m_nCount = 0;
// other member variables and whatnot follow
--------
Thats it. I hope this is clear...
Tom Hite
thite AT micrografx DOT com
- Raw text -