Static member data inaccessible
Hi, I'm making a little Chess program for my first C++ project. I've done a whole lot of programming before, so don't worry.
OK, I have two static variables of the ChessPiece class:
Code:
static uShort whitePieces;
static uShort blackPieces;
And I'm trying to access them in the constructor:
Code:
if (side == White)
{
whitePieces++;
}
else
{
blackPieces++;
}
For some reason, my DJGPP gcc compiler (used through RHIDE, my IDE) returns:
undefined reference to 'ChessPiece::whitePieces'
undefined reference to 'ChessPiece::blackPieces'
Oh, and yes I have tried this:
Code:
if (side == White)
{
ChessPiece::whitePieces++;
}
else
{
ChessPiece::blackPieces++;
}
Same problem. Can anyone solve this?