c++ - VS 2010: error LNK2019: unresolved external symbol "extern "C" void * __cdecl -


i'm new in c++, tried copy code , run in visual studio 2010. giving unresolved extern 'c' error , unresolved token "extern "c" listed below code.

this code causing errors :

#ifdef _managed     // works managed c++ #pragma once #pragma managed(push, on) #include <stdlib.h>     //free  typedef void (__cdecl *_pvfv)(void); extern "c" void * __cdecl _decode_pointer(void *); extern "c" void * __cdecl _encoded_null();  // crtdll.c extern "c" _pvfv *__onexitbegin; extern "c"  _pvfv *__onexitend;    void crtdestroystatics(void) {     _pvfv * onexitbegin = (_pvfv *)_decode_pointer(__onexitbegin);     if (onexitbegin)     {         _pvfv * onexitend = (_pvfv *)_decode_pointer(__onexitend);         _pvfv function_to_call = null;          /* save start , end later comparison */         _pvfv * onexitbegin_saved = onexitbegin;         _pvfv * onexitend_saved = onexitend;          while (1)         {             _pvfv * onexitbegin_new = null;             _pvfv * onexitend_new = null;              /* find last valid function pointer call. */             while (--onexitend >= onexitbegin && (*onexitend == null || *onexitend == _encoded_null()))             {                 /* keep going backwards. */             }              if (onexitend < onexitbegin)             {                 /* there no more valid entries in list, done. */                 break;             }              /* cache function call. */             function_to_call = (_pvfv)_decode_pointer(*onexitend);              /* mark function pointer visited. */             *onexitend = (_pvfv)_encoded_null();              /* call function, can change __onexitbegin , __onexitend */             (*function_to_call)();              onexitbegin_new = (_pvfv *)_decode_pointer(__onexitbegin);             onexitend_new = (_pvfv *)_decode_pointer(__onexitend);              if ( ( onexitbegin_saved != onexitbegin_new ) || ( onexitend_saved != onexitend_new ) )             {                 /* reset if either start or end has changed */                  __onexitbegin = onexitbegin_saved = onexitbegin_new;                  __onexitend = onexitend_saved = onexitend_new;             }              break;         }         /*         * free block holding onexit table         * avoid memory leaks.  0 ptr         * variables cleaned up.         */          free ( onexitbegin ) ;          __onexitbegin = __onexitend = (_pvfv *)_encoded_null();     }  } //crtdestroystatics  #pragma managed(pop) #endif 

and here linker errors:

error   4   error lnk2019: unresolved external symbol "extern "c" void * __cdecl _decode_pointer(void *)" (?_decode_pointer@@$$j0yapeaxpeax@z) referenced in function "void __cdecl crtdestroystatics(void)" (?crtdestroystatics@@$$fyaxxz) error   3   error lnk2028: unresolved token (0a000f2f) "extern "c" void * __cdecl _decode_pointer(void *)" (?_decode_pointer@@$$j0yapeaxpeax@z) referenced in function "void __cdecl crtdestroystatics(void)" (?crtdestroystatics@@$$fyaxxz) 

although have libraries values inherited additional dependencies in linker->input

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib  

please tell me wrong have committed?

if _decode_poiner not available in kernel32, seems configuration not correctly setup. if had older version of vs , upgraded, make sure linker doesn't point old environment.

you can check here additional information on how solve this.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -