Compiler Error C2457
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Error C2457

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

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

The following sample generates C2457:

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

__FUNCTION__;   // C2457, cannot be global

int main() 
    printf_s("\n%s",__FUNCTION__);   // OK
© 2015 Microsoft