error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall DuiLib::WindowImplBase::WindowImp

本文解决了Duilib开发中常见的编译错误,如无法解析的外部符号等问题,并提供了详细的解决步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自VC错误:http://www.vcerror.com/?p=2078
问题描述:

在做duilib开发的时候,编译一个示例工程,出现如下错误:
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall DuiLib::WindowImplBase::WindowImplBase(void)" (__imp_??0WindowImplBase@DuiLib@@QAE@XZ)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual __thiscall DuiLib::WindowImplBase::~WindowImplBase(void)" (__imp_??1WindowImplBase@DuiLib@@UAE@XZ)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual void __thiscall DuiLib::WindowImplBase::OnFinalMessage(struct HWND__ *)" (__imp_?OnFinalMessage@WindowImplBase@DuiLib@@UAEXPAUHWND__@@@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall DuiLib::CDuiString::CDuiString(char const *,int)" (__imp_??0CDuiString@DuiLib@@QAE@PBDH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall DuiLib::CDuiString::~CDuiString(void)" (__imp_??1CDuiString@DuiLib@@QAE@XZ)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class DuiLib::CControlUI * __thiscall DuiLib::CPaintManagerUI::FindControl(char const *)const " (__imp_?FindControl@CPaintManagerUI@DuiLib@@QBEPAVCControlUI@2@PBD@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall DuiLib::CWebBrowserUI::SetHomePage(char const *)" (__imp_?SetHomePage@CWebBrowserUI@DuiLib@@QAEXPBD@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: bool __thiscall DuiLib::CDuiString::operator==(char const *)const " (__imp_??8CDuiString@DuiLib@@QBE_NPBD@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) protected: virtual char const * __thiscall DuiLib::CWindowWnd::GetSuperClassName(void)const " (__imp_?GetSuperClassName@CWindowWnd@DuiLib@@MBEPBDXZ)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual unsigned int __thiscall DuiLib::WindowImplBase::GetClassStyle(void)const " (__imp_?GetClassStyle@WindowImplBase@DuiLib@@UBEIXZ)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::HandleMessage(unsigned int,unsigned int,long)" (__imp_?HandleMessage@WindowImplBase@DuiLib@@UAEJIIJ@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) protected: virtual void __thiscall DuiLib::WindowImplBase::OnClick(struct DuiLib::tagTNotifyUI &)" (__imp_?OnClick@WindowImplBase@DuiLib@@MAEXAAUtagTNotifyUI@2@@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual char const * __thiscall DuiLib::WindowImplBase::GetResourceID(void)const " (__imp_?GetResourceID@WindowImplBase@DuiLib@@UBEPBDXZ)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnClose(unsigned int,unsigned int,long,int &)" (__imp_?OnClose@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnDestroy(unsigned int,unsigned int,long,int &)" (__imp_?OnDestroy@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnNcActivate(unsigned int,unsigned int,long,int &)" (__imp_?OnNcActivate@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnNcCalcSize(unsigned int,unsigned int,long,int &)" (__imp_?OnNcCalcSize@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnNcPaint(unsigned int,unsigned int,long,int &)" (__imp_?OnNcPaint@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnNcHitTest(unsigned int,unsigned int,long,int &)" (__imp_?OnNcHitTest@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnGetMinMaxInfo(unsigned int,unsigned int,long,int &)" (__imp_?OnGetMinMaxInfo@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnMouseWheel(unsigned int,unsigned int,long,int &)" (__imp_?OnMouseWheel@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnMouseHover(unsigned int,unsigned int,long,int &)" (__imp_?OnMouseHover@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnSize(unsigned int,unsigned int,long,int &)" (__imp_?OnSize@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnChar(unsigned int,unsigned int,long,int &)" (__imp_?OnChar@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnSysCommand(unsigned int,unsigned int,long,int &)" (__imp_?OnSysCommand@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnCreate(unsigned int,unsigned int,long,int &)" (__imp_?OnCreate@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnKeyDown(unsigned int,unsigned int,long,int &)" (__imp_?OnKeyDown@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnKillFocus(unsigned int,unsigned int,long,int &)" (__imp_?OnKillFocus@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnSetFocus(unsigned int,unsigned int,long,int &)" (__imp_?OnSetFocus@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnLButtonDown(unsigned int,unsigned int,long,int &)" (__imp_?OnLButtonDown@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnLButtonUp(unsigned int,unsigned int,long,int &)" (__imp_?OnLButtonUp@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::OnMouseMove(unsigned int,unsigned int,long,int &)" (__imp_?OnMouseMove@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::HandleCustomMessage(unsigned int,unsigned int,long,int &)" (__imp_?HandleCustomMessage@WindowImplBase@DuiLib@@UAEJIIJAAH@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::GetStyle(void)" (__imp_?GetStyle@WindowImplBase@DuiLib@@UAEJXZ)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) protected: virtual struct DuiLib::DUI_MSGMAP const * __thiscall DuiLib::WindowImplBase::GetMessageMap(void)const " (__imp_?GetMessageMap@WindowImplBase@DuiLib@@MBEPBUDUI_MSGMAP@2@XZ)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual long __thiscall DuiLib::WindowImplBase::MessageHandler(unsigned int,unsigned int,long,bool &)" (__imp_?MessageHandler@WindowImplBase@DuiLib@@UAEJIIJAA_N@Z)
1>DuiWebWnd.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual class DuiLib::CControlUI * __thiscall DuiLib::WindowImplBase::CreateControl(char const *)" (__imp_?CreateControl@WindowImplBase@DuiLib@@UAEPAVCControlUI@2@PBD@Z)
1>testWebUI.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static void __cdecl DuiLib::CPaintManagerUI::SetInstance(struct HINSTANCE__ *)" (__imp_?SetInstance@CPaintManagerUI@DuiLib@@SAXPAUHINSTANCE__@@@Z)
1>testWebUI.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static void __cdecl DuiLib::CPaintManagerUI::SetResourcePath(char const *)" (__imp_?SetResourcePath@CPaintManagerUI@DuiLib@@SAXPBD@Z)
1>testWebUI.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall DuiLib::CDuiString::operator char const *(void)const " (__imp_??BCDuiString@DuiLib@@QBEPBDXZ)
1>testWebUI.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class DuiLib::CDuiString __cdecl DuiLib::CPaintManagerUI::GetInstancePath(void)" (__imp_?GetInstancePath@CPaintManagerUI@DuiLib@@SA?AVCDuiString@2@XZ)
1>testWebUI.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct HWND__ * __thiscall DuiLib::CWindowWnd::Create(struct HWND__ *,char const *,unsigned long,unsigned long,int,int,int,int,struct HMENU__ *)" (__imp_?Create@CWindowWnd@DuiLib@@QAEPAUHWND__@@PAU3@PBDKKHHHHPAUHMENU__@@@Z)
1>testWebUI.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall DuiLib::CWindowWnd::CenterWindow(void)" (__imp_?CenterWindow@CWindowWnd@DuiLib@@QAEXXZ)
1>testWebUI.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall DuiLib::CWindowWnd::ShowWindow(bool,bool)" (__imp_?ShowWindow@CWindowWnd@DuiLib@@QAEX_N0@Z)

1>testWebUI.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static void __cdecl DuiLib::CPaintManagerUI::MessageLoop(void)" (__imp_?MessageLoop@CPaintManagerUI@DuiLib@@SAXXZ)


解决方法:
具体的解决方法参考文章:http://www.vcerror.com/?p=2078
引用\[1\]: VC++时经常会遇到链接错误LNK2001,该错误非常讨厌,因为对于编程者来说,最好改的错误莫过于编译错误,而一般说来发生连接错误时,编译都已通过。产生连接错误的原因非常多,尤其LNK2001错误,常常使人不明其所以然。如果不深入地学习和理解VC++,要想改正连接错误LNK2001非常困难。初学者在学习VC++的过程中,遇到的LNK2001错误的错误消息主要为:unresolved external symbol "symbol"(不确定的外部"符号")。如果连接程序不能在所有的库和目标文件内找到所引用的函数、变量或标签,将产生此错误消息。一般来说,发生错误的原因有两个:一是所引用的函数、变量不存在、拼写不正确或者使用错误;其次可能使用了不同版本的连接库。\[1\] 引用\[2\]: 出现这个错误,应该首先查看"#include"语句是否包含,或者是否包含正确。符号无法解析意味着编译器知道有这个符号存在,也就是有声明,但在链接时,找不到实现代码,那么就去看看报错的这个函数有没有实现代码。如果它们的确已经有了,还是出现这个错误,就把它们重新编译一下。\[2\] 引用\[3\]: 使用/MD选项编译时,既然所有的运行库都被保留在动态链接库之内,源文件中对"func"的引用,在目标文件里即对"__imp__func"的引用。如果试图使用静态LIBC.LIB或LIBCMT.LIB进行连接,将在__imp__func上发生LNK2001;如果不使用/MD选项编译,在使用MSVCxx.LIB连接时也会发生LNK2001。\[3\] 问题: qt PCL error LNK2001: 无法解析外部符号 "__declspec(dllimport) public" 回答: 出现LNK2001错误通常是因为连接程序无法找到所引用的函数或变量的实现代码。对于qt PCL error LNK2001: 无法解析外部符号 "__declspec(dllimport) public"这个错误,可能是由于缺少相应的库文件或者库文件版本不匹配所致。首先,你可以检查是否正确包含了相关的头文件,然后查看是否正确链接了相应的库文件。如果确认这些都没有问题,可以尝试重新编译相关的代码。如果问题仍然存在,可能需要进一步检查编译选项是否正确设置,比如是否使用了正确的编译选项/MD。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* *3* [Error LNK2001 无法解析外部符号 的几种情况及解决办法](https://blog.youkuaiyun.com/shenyulv/article/details/6699836)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [VC++常见错误原因解析error LNK2019: 无法解析外部符号 "public: void __thiscall](https://blog.youkuaiyun.com/weixin_42040046/article/details/102723809)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值