Possible Duplicate:
C++: undefined reference to static class member
I'm using MinGW. Why static variable is not working
[Linker error] undefined reference to `A::i'
#include <windows.h>
class A {
public:
static int i;
static int init(){
i = 1;
}
};
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil){
A::i = 0;
A::init();
return 0;
}