none
error LNK2028: unresolved token "extern "C"

    Question

  • Hello Experts,

    I'm trying to enhance my C++ application by updating some library & header files and make it work for 64 bit server instead of 32 bit. However, after that I've got the 13 pairs of errors like this:

    1>MainFrm.obj : error LNK2028: unresolved token (0A00084E) "extern "C" int __cdecl omniapi_read_event_ext_ex(void *,unsigned int,char *,unsigned int *,int *,int)" (?omniapi_read_event_ext_ex@@$$J0YAHPAXIPADPAIPAHH@Z) referenced in function "extern "C" int __cdecl OAPI_GetAllEventTypes(char * *,unsigned int *)" (?OAPI_GetAllEventTypes@@$$J0YAHPAPADPAI@Z)
    
    1>MainFrm.obj : error LNK2019: unresolved external symbol "extern "C" int __cdecl omniapi_read_event_ext_ex(void *,unsigned int,char *,unsigned int *,int *,int)" (?omniapi_read_event_ext_ex@@$$J0YAHPAXIPADPAIPAHH@Z) referenced in function "extern "C" int __cdecl OAPI_GetAllEventTypes(char * *,unsigned int *)" (?OAPI_GetAllEventTypes@@$$J0YAHPAPADPAI@Z)

    What does it mean by unresolved externals? 

    Does it mean I must have missed the setup in project property's Liner/Input/Additional Dependencies? What other possibilities?

    Although they are not system libraries, how could I check what is missing in my code and configurations?

    Thanks in advance!

    raven

    Tuesday, April 24, 2012 1:44 AM

Answers

  • Thanks Brian for your reply.

    I finally find out that I need to change my project property to Platform x64 rather than x32 before compile because the lib upgraded was for x64 only.

    Cheers:)

    • Marked as answer by raven___ Tuesday, April 24, 2012 8:16 AM
    Tuesday, April 24, 2012 6:01 AM

All replies

  • In addition, here is part of my code for your reference:

    extern "C" int32 OAPI_GetAllEventTypes(char **strBuffer, uint32 *buffSize)
    {
    	int32    completionStatus;
    
        completionStatus = omniapi_read_event_ext_ex( hSession, OMNI_EVTTYP_SHOW, *strBuffer, buffSize, 0, 0);
    
        while( completionStatus == OMNIAPI_TRUNCATED )   
        {
            free(*strBuffer);                               
            *buffSize *= 2;
            *strBuffer = (int8*)malloc(*buffSize);
            completionStatus = omniapi_read_event_ext_ex(hSession,OMNI_EVTTYP_SHOW, *strBuffer, buffSize, 0, 0);
        }
    

    hope not too confusing...

    Tuesday, April 24, 2012 2:08 AM

  • It means you are calling the function omniapi_read_event_ext_ex () but it isn't defined anywhere in your source code. Perhaps you are missing a *.lib reference under Configuration Properties, Linker, Input, Additional Dependencies
    Tuesday, April 24, 2012 4:33 AM
  • Thanks Brian for your reply.

    I finally find out that I need to change my project property to Platform x64 rather than x32 before compile because the lib upgraded was for x64 only.

    Cheers:)

    • Marked as answer by raven___ Tuesday, April 24, 2012 8:16 AM
    Tuesday, April 24, 2012 6:01 AM