LNK2001: Unresolved external symbol "class ATL::CStringT..."
I am recieving the following error:
Error 1 error LNK2001: unresolved external symbol "class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __cdecl messageForCode(int,class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?messageForCode@@YA?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@HV12@@Z) MyUIDlg.obj
E开发者_如何学运维rror 2 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\Administrator\Desktop\my-project\MyUI\Release\MyUI.exe
messageForCode
is defined within a project MyLibrary
that is compiled into a static library. This library doesn't depend on MFC and so includes CString using "#include ". It compiles fine by itself.
MyUI
is an .exe project that fails to compile due to the above error. It uses MFC. One theory I have is that there is a conflict between the CString in MFC and the one in atlstr.h
. I tried linking both statically and dynamically to ATL in the settings of both projects, but I couldn't resolve the error.
Is messageForCode implemented in C or in C++? In case it is implemented in C you need to wrap its declaration with 'extern "C"'.
精彩评论