今天编译popo库,它用的是 Use MFC in a Shared DLL, 编译后的结果为Dll,我自己有一个客户端工程,要使用该Dll,它使用MFC时Use MFC in a Static Library,结果老是编译不过去,报错如下
1>PoPoTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall popo::ui::CSkinObject::SetObjectID(class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (__imp_?SetObjectID@CSkinObject@ui@popo@@QAEXV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) referenced in function "public: virtual int __thiscall CPoPoTestApp::InitInstance(void)" (?InitInstance@CPoPoTestApp@@UAEHXZ)
通过objdump /t看了下,结果存在一个这样的符号,
__imp_?SetObjectID@CSkinObject@ui@popo@@QAEXV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z
猜测是CString的第二个模板实参的问题,在头文件中把
void SetObjectID(const CString sID);
修改为