Compiler Error C2357
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 C2357.
identifier' : must be a function of type 'type'
Your code declares a version of the atexit function that does not match the version declared internally by the compiler. Declare atexit as follows:
int __cdecl atexit(void (__cdecl *)());
For more information, see init_seg.
The following sample generates C2357:
// C2357.cpp
// compile with: /c
// C2357 expected
#pragma warning(disable : 4075)
// Uncomment the following line to resolve.
// int __cdecl myexit(void (__cdecl *)());
#pragma init_seg(".mine$m",myexit)
Show: