コンパイラエラー C2071
'識別子' : ストレージ クラスが正しくありません。
identifier が無効な identifierで宣言されました。 1 つの識別子に複数のストレージ クラスが指定されている場合や、定義がストレージ クラスの宣言と互換性がない場合に、このエラーが発生することがあります。
この問題を解決するには、識別子の目的のストレージクラス (やなど) を理解し、 —staticextern— 一致するように宣言を修正します。
例
次の例では 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