编译器错误 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
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈