'identifier' : must be a function of type 'type'
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 *)());