Possible Duplicate:
static member variable in a class
What is an undefined reference/unresolved external symbol error and how do I fix it?
class test_struct {
static int number;
public:
static void set() {
number = 42;
}
};
int main() {
test_struct::set();
}
The error is:
[...]Temp\ccGGxEAz.o:test.cpp:(.text.startup+0xf): undefined reference to `test_struct::number'
collect2.exe: error: ld returned 1 exit status