“identifier”使用未定义的类/结构/联合“name”
指定的标识符是未定义的类、结构或联合。
此错误可能由初始化匿名联合导致。
以下示例生成 C2079:
// C2079.cpp
// compile with: /EHsc
#include <iostream>
int main() {
std::ifstream g; // C2079
}
可能的解决方法:
// C2079b.cpp
// compile with: /EHsc
#include <fstream>
int main( ) {
std::ifstream g;
}
如果尝试在前向声明仅在范围内的类型的堆栈上声明对象,也可能会发生 C2079。
// C2079c.cpp
class A;
class B {
A a; // C2079
};
class A {};
可能的解决方法:
// C2079d.cpp
// compile with: /c
class A;
class C {};
class B {
A * a;
C c;
};
class A {};