Compiler Error C2653

 

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

For the latest documentation on Visual Studio 2017, see Compiler Error C2653 on docs.microsoft.com. 'identifier' : is not a class or namespace name

Syntax requires a class, structure, union, or namespace name.

The following sample generates C2653:

// C2653.cpp  
// compile with: /c  
class yy {  
   void func1(int i);  
};  
  
void xx::func1(int m) {}   // C2653  
void yy::func1(int m) {}   // OK  

C2653 is also possible if you try to define a compound namespace; compound namespaces are not allowed in C++:

// C2653b.cpp  
namespace a::b {int i;}   // C2653  
  
namespace a {  
   namespace b {  
      int i;  
   }  
}  
  
int main() {  
   a::b::i = 2;  
}  

Show: