Compiler Error C2457
TOC
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

Compiler Error C2457

Error Message

'macro': predefined macro cannot appear outside of a function body

You attempted to use a predefined macro, such as __FUNCTION__, in a global space.

Example

The following sample generates C2457:

// C2457.cpp
#include <stdio.h>

__FUNCTION__;   // C2457, cannot be global

int main() 
{
    printf_s("\n%s",__FUNCTION__);   // OK
}
Show:
© 2016 Microsoft