Compiler Error C2457
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at 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
}
Show: