Compiler Error C2624

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see Compiler Error C2624 on docs.microsoft.com. local classes cannot be used to declare 'extern' variables

A local class or structure cannot be used to declare extern variables.

The following sample generates C2624:

// C2624.cpp  
int main() {  
   struct C {};  
   extern C ac;   // C2624  
}  

Show: