Compiler Error C2597

illegal reference to data member 'member' in a static member function

The identifier you specified is a member of the class.  However, it is nonstatic and the current function is a static member function.  To access the member, an instance of the class must be provided and accessed using the . or -> operators.

The specified identifier was not a member of a class, structure, or union.

A member access operator (. or ->) was used to refer to a function that was not defined as a member of the class, structure, or union.

The following code in a .cpp file will generate C2597:

struct s1 {
   static void   func();
   int   i;
};

void s1::func()
{
   i = 1;   // error C2597 here
}