Error Message
'identifier' : is not a class or namespace name
语法需要一个类、结构体、联合体或命名空间名字。
下列示例产生C2653:
Code
// C2653.cpp
// compile with: /c
class yy {
void func1(int i);
};
void xx::func1(int m) {} // C2653
void yy::func1(int m) {} // OK
// C2653.cpp
// compile with: /c
class yy {
void func1(int i);
};
void xx::func1(int m) {} // C2653
void yy::func1(int m) {} // OK
如果你试图定义一个复合的命名控件也可能出现C2653;在C++中是不允许复合命名空间的:
Code
// C2653b.cpp
namespace a::b {int i;} // C2653
namespace a {
namespace b {
int i;
}
}
int main() {
a::b::i = 2;
}
// C2653b.cpp
namespace a::b {int i;} // C2653
namespace a {
namespace b {
int i;
}
}
int main() {
a::b::i = 2;
}