分享方式:


編譯器錯誤 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