编译器错误 C2071
'identifier':非法存储类
已使用无效的存储类声明 identifier
。 为标识符指定多个存储类时或定义与存储类声明不兼容时,会导致此错误。
若要解决此问题,请了解标识符的预期存储类(例如,static
或 extern
),并更正要匹配的声明。
示例
以下示例生成 C2071。
// C2071.cpp
// compile with: /c
struct C {
extern int i; // C2071
};
struct D {
int i; // OK, no extern on an automatic
};
以下示例生成 C2071。
// C2071_b.cpp
// compile with: /c
typedef int x(int i) { return i; } // C2071
typedef int (x)(int); // OK, no local definition in typedef