Ambil perhatian
Akses ke halaman ini memerlukan kebenaran. Anda boleh cuba log masuk atau menukar direktori.
Akses ke halaman ini memerlukan kebenaran. Anda boleh cuba menukar direktori.
use of undefined type 'type'
Remarks
A type cannot be used until it is defined. To resolve the error, be sure the type is fully defined before referencing it.
Examples
The following example generates C2027.
// C2027.cpp
class C;
class D {
public:
void func() {
}
};
int main() {
C *pC;
pC->func(); // C2027
D *pD;
pD->func();
}
It is possible to declare a pointer to a declared but undefined type. But C++ does not allow a reference to an undefined type.
The following example generates C2027.
// C2027_b.cpp
class A;
A& CreateA();
class B;
B* CreateB();
int main() {
CreateA(); // C2027
CreateB(); // OK
}