Compiler Error C2071
'identifier' : illegal storage class
identifier
was declared with an invalid storage class. This error can be caused when more than one storage class is specified for an identifier, or when the definition is incompatible with the storage class declaration.
To fix this issue, understand the intended storage class of the identifier—for example, static
or extern
—and correct the declaration to match.
Examples
The following sample generates C2071.
// C2071.cpp
// compile with: /c
struct C {
extern int i; // C2071
};
struct D {
int i; // OK, no extern on an automatic
};
The following sample generates 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