J
jois.de.vivre
Hi, I'm having some linker issues when using static variables in a
class.
class TestClass
{
public:
TestClass()
{
Count++;
}
private:
static int Count;
};
int main(int argc, char *argv[])
{
TestClass T;
return EXIT_SUCCESS;
}
The above gives me an undefined reference (to TestClass::Count) error
during linking. How can I get this to work without having to put my
function definitions in a cpp file?
Thanks
class.
class TestClass
{
public:
TestClass()
{
Count++;
}
private:
static int Count;
};
int main(int argc, char *argv[])
{
TestClass T;
return EXIT_SUCCESS;
}
The above gives me an undefined reference (to TestClass::Count) error
during linking. How can I get this to work without having to put my
function definitions in a cpp file?
Thanks