Static variables must be allocated outside the class. Add this line outside of class B:
int B::b;
Think of static variables declared using the extern keyword. They still need to be allocated somewhere. This means that the distribution should never be in the header file!
source share