This documentation is archived and is not being maintained.

Compiler Error C2156

Error Message

pragma must be outside function

A pragma that must be specified at a global level (outside a function body) is within a function.

The following sample generates C2156:

// C2156.cpp
#pragma optimize( "l", on )   // OK
int main() {
   #pragma optimize( "l", on )   // C2156