unresolved external symbol _GetLblAddress@0 ...

Started by sukratu, December 29, 2015, 05:57:34 PM

Previous topic - Next topic

sukratu

Hi,
I am getting a linker error like
error LNK2019: unresolved external symbol _GetLblAddress@0 referenced in function _callasm@0..
where GetLblAddress is defined in separate asm file.
I am using VS 2013 project and compiling it as win32 project ("/TC")

.asm code
-----------------------------------------------------------
.586
.model flat, c

.code

PUBLIC GetLblAddress

GetLblAddress PROC
   
    //some assembly code
    //some assembly code

           ret

GetLblAddress ENDP

END

.C code
-----------------------------------------------------------
extern int GetLblAddress();
void callasm()
{
    int lbl = GetLblAddress();
    printf(...);
}

in compilation I am getting linker error.
I tried changing the name to _GetLblAddress but still getting same error.


jj2007


TWell

In C code define
extern int __cdecl GetLblAddress(void);
Because of your code.model flat, c
...
GetLblAddress PROC
GetLblAddress ENDP

jj2007


sukratu