Export (0) Print
Expand All
Expand Minimize

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

Community Additions

© 2014 Microsoft