Compiler Error C2655

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see Compiler Error C2655 on docs.microsoft.com. 'identifier' : definition or redeclaration illegal in current scope

An identifier can be redeclared only at global scope.

The following sample generates C2655:

// C2655.cpp  
class A {};  
class B {  
public:  
   static int i;  
};  
  
int B::i;  // OK  
  
int main() {  
   A B::i;  // C2655  
}  

Show: