unresolved external symbol error. dumpbin shows extra @number appended to symbols
My knowledge is C is very limited. I am trying to upgrade a library used in my project. I replaced the old static library and header file with the updated files. When I try to build my project, I am getting the "unresolved external symbol" error.
I inspected both the old and new lib files using dumpbin and found that the symbols in the new library has an extra @number (where number is one of 8, 16, 24, 28, 32, 40, 48, 52, 72 or 80) appended. Can someone please tell me how to proceed?
Update
The error stopped somehow. B开发者_如何转开发ut now I am getting the error
LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRT.lib(MSVCR90.dll)
I tried adding /NODEFAULTLIB:LIBCMT.lib
to the compiler options for the library. But still I am getting the same error.
Symbols appended with the @
symbol and a number are functions that use the stdcall
calling convention. It would appear you are compiling the new library with stdcall
as the default instead of cdecl
.
Look in the header file at the function declarations. You will most likely see something indicating this alternate calling convention. If you do not and you are sure the static library you have matches the header file you could update the function declarations in the header file to include the stdcall
calling convention. Then when compiling your program that uses the static library the symbols in your program will correctly look for the stdcall
style function symbols.
Addressing Update
This is probably a conflict with what you are linking your static library to and what you are linking your final binary to. Both your static library and your final program binary must link against the same C runtime.
精彩评论