S
sieg1974
Hi,
I have this following class, but when I compile it, gcc shows a error
message "undefined reference to `Animal::theNumberOfAnimals`".
I know this must be very easy to fix, but for a newnie like me it's
not
Thanks in advance,
Andre
class Animal
{
private:
char theName[ 128 ];
static int theNumberOfAnimals;
public:
Animal()
{
theNumberOfAnimals++;
};
Animal( char * name )
{
strcpy( theName, name );
theNumberOfAnimals++;
};
~Animal(){};
};
I have this following class, but when I compile it, gcc shows a error
message "undefined reference to `Animal::theNumberOfAnimals`".
I know this must be very easy to fix, but for a newnie like me it's
not
Thanks in advance,
Andre
class Animal
{
private:
char theName[ 128 ];
static int theNumberOfAnimals;
public:
Animal()
{
theNumberOfAnimals++;
};
Animal( char * name )
{
strcpy( theName, name );
theNumberOfAnimals++;
};
~Animal(){};
};