c++ - Unresolved external symbol error occurring only in 64-bit mode and not in 32-bit build -
i have vc++ code (built using vs2008), makes use of static libraries (*.lib files linked statically during compile time).
for ease of understanding let's refer exe code "aaa.exe" & refer lib files "a.lib", b.lib etc...
both aaa.exe code , static libraries code built using vs2008.
i see "aaa.exe" working fine in 32-bit version , showing below linker errors when aaa.exe built in 64-bit mode.
i have of course rebuilt static libraries in 64-bit mode , provided lib path in aaa.exe :: "project configuration properties corresponding aaa.exe -> linker -> general/input".
this linker error bothering me form long time. appreciated.
logger.lib(loggerr.obj) : error lnk2001: unresolved external symbol "__declspec(dllimport) public: __thiscall cwttlogger::cwttlogger(void)" (__imp_??0cwttlogger@@qae@xz) 1>logger.lib(logger.obj) : error lnk2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall cwttlogger::~cwttlogger(void)" (__imp_??1cwttlogger@@uae@xz) 1>logger.lib(logger.obj) : error lnk2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall cwttlogger::functiona(unsigned short *,long *)" (__imp_?functiona@cwttlogger@@qaejpagpaj@z) 1>logger.lib(logger.obj) : error lnk2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall cwttlogger::functionb(unsigned short *,long)" (__imp_?functionb@cwttlogger@@qaejpagj@z) 1>logger.lib(logger.obj) : error lnk2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall cwttlogger::functionc(unsigned short *,unsigned long,unsigned short *,long)" (__imp_?functionc@cwttlogger@@qaejpagk0j@z) 1>logger.lib(logger.obj) : error lnk2001: unresolved external symbol "__declspec(dllimport) public: long __cdecl cwttlogger::functiond(unsigned long,long,...)" (__imp_?functiond@cwttlogger@@qaajkjzz) 1>logger.lib(logger.obj) : error lnk2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall cwttlogger::functione(unsigned short *,long)" (__imp_?functione@cwttlogger@@qaejpagj@z) 1>c:\users\user1\documents\xyz\code\64bit\aaa.exe: fatal error lnk1120: 7 unresolved externals
also add ::
i have done 2 changes in settings make aaa.exe code 64-bit 32-bit:: 1)
2)
ofcourse code compatible both 32-bit & 64-bit. these 2 settings changes in vc2008 complete making 32-bit aaa.exe code 64-bit build?
by looking @ stackoverflow link see there 1 more settoing in "project configuration properties -> linker-> advanced-> target machine default "not set" , if make target machine == "machinex64", different sort of error getting earlier ::
"fatal error lnk1112: module machine type 'x86' conflicts target machine type 'x64'"
i'm not having clarity on if should setting "target machine" field in linker option "not set" or "machinex64"?
if it's "yes", need figure out how fix problem.
from looks of it, you're changing half of projects x64
, leave rest win32
. since don't show project's dependencies, hard guess if that's problem or not ... in case, compilation succeed you'll have switch of dependent projects (libs) x64!
Comments
Post a Comment