Compiler Error C2653


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Compiler Error C2653.

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;