编译MFC程序时链接器错误

时间:2015-05-12 12:16:56

标签: mfc linker-errors

我在构建如何解决这些错误时遇到这些链接器错误?

1>SettingsDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::DeleteKey(wchar_t const *)" (__imp_?DeleteKey@CRegistry@@QAEHPB_W@Z) referenced in function "private: void __thiscall CSettingsDlg::SaveSettings(void)" (?SaveSettings@CSettingsDlg@@AAEXXZ)
1>SettingsDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::PutStringValue(wchar_t const *,wchar_t const *)" (__imp_?PutStringValue@CRegistry@@QAEHPB_W0@Z) referenced in function "private: void __thiscall CSettingsDlg::SaveSettings(void)" (?SaveSettings@CSettingsDlg@@AAEXXZ)
1>VWScanConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::PutStringValue(wchar_t const *,wchar_t const *)" (__imp_?PutStringValue@CRegistry@@QAEHPB_W0@Z)
1>SettingsDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::PutWordValue(wchar_t const *,unsigned long)" (__imp_?PutWordValue@CRegistry@@QAEHPB_WK@Z) referenced in function "private: void __thiscall CSettingsDlg::SaveSettings(void)" (?SaveSettings@CSettingsDlg@@AAEXXZ)
1>VWScanConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::PutWordValue(wchar_t const *,unsigned long)" (__imp_?PutWordValue@CRegistry@@QAEHPB_WK@Z)
1>SettingsDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::SetWorkKey(wchar_t const *)" (__imp_?SetWorkKey@CRegistry@@QAEHPB_W@Z) referenced in function "private: void __thiscall CSettingsDlg::SaveSettings(void)" (?SaveSettings@CSettingsDlg@@AAEXXZ)
1>VWScanCon.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::SetWorkKey(wchar_t const *)" (__imp_?SetWorkKey@CRegistry@@QAEHPB_W@Z)
1>VWScanConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::SetWorkKey(wchar_t const *)" (__imp_?SetWorkKey@CRegistry@@QAEHPB_W@Z)
1>SettingsDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CResCtrl::LoadStringW(unsigned int)" (__imp_?LoadStringW@CResCtrl@@QAE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@I@Z) referenced in function "private: void __thiscall CSettingsDlg::SaveSettings(void)" (?SaveSettings@CSettingsDlg@@AAEXXZ)
1>VWScanCon.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CResCtrl::LoadStringW(unsigned int)" (__imp_?LoadStringW@CResCtrl@@QAE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@I@Z)
1>VWScanConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CResCtrl::LoadStringW(unsigned int)" (__imp_?LoadStringW@CResCtrl@@QAE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@I@Z)
1>SettingsDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::GetStringValue(wchar_t const *,wchar_t *,wchar_t const *)" (__imp_?GetStringValue@CRegistry@@QAEHPB_WPA_W0@Z) referenced in function "private: void __thiscall CSettingsDlg::LoadSettings(void)" (?LoadSettings@CSettingsDlg@@AAEXXZ)
1>VWScanConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::GetStringValue(wchar_t const *,wchar_t *,wchar_t const *)" (__imp_?GetStringValue@CRegistry@@QAEHPB_WPA_W0@Z)
1>SettingsDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::GetWordValue(wchar_t const *,unsigned long *,unsigned long)" (__imp_?GetWordValue@CRegistry@@QAEHPB_WPAKK@Z) referenced in function "private: void __thiscall CSettingsDlg::LoadSettings(void)" (?LoadSettings@CSettingsDlg@@AAEXXZ)
1>VWScanConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::GetWordValue(wchar_t const *,unsigned long *,unsigned long)" (__imp_?GetWordValue@CRegistry@@QAEHPB_WPAKK@Z)
1>Viewer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall CLog::PrintLog(wchar_t const *,enum LOGTXTTYPE,long)" (__imp_?PrintLog@CLog@@QAEXPB_WW4LOGTXTTYPE@@J@Z) referenced in function "public: int __thiscall CViewer::DoBatchScan(void)" (?DoBatchScan@CViewer@@QAEHXZ)
1>VWScanConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall CLog::PrintLog(wchar_t const *,enum LOGTXTTYPE,long)" (__imp_?PrintLog@CLog@@QAEXPB_WW4LOGTXTTYPE@@J@Z)
1>VWScanCon.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::CreateKey(wchar_t const *)" (__imp_?CreateKey@CRegistry@@QAEHPB_W@Z) referenced in function "public: virtual int __thiscall CVWScanConApp::InitInstance(void)" (?InitInstance@CVWScanConApp@@UAEHXZ)
1>VWScanCon.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::Initialize(enum CALLERTYPE,struct HKEY__ *,wchar_t const *)" (__imp_?Initialize@CRegistry@@QAEHW4CALLERTYPE@@PAUHKEY__@@PB_W@Z) referenced in function "public: virtual int __thiscall CVWScanConApp::InitInstance(void)" (?InitInstance@CVWScanConApp@@UAEHXZ)
1>VWScanCon.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall CLog::Initialize(enum CALLERTYPE,wchar_t const *,int,unsigned long,unsigned long)" (__imp_?Initialize@CLog@@QAEXW4CALLERTYPE@@PB_WHKK@Z) referenced in function "public: virtual int __thiscall CVWScanConApp::InitInstance(void)" (?InitInstance@CVWScanConApp@@UAEHXZ)
1>VWScanConnector.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall CXMLManager::CXMLManager(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (__imp_??0CXMLManager@@QAE@V?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) referenced in function "public: virtual int __thiscall CVWScanConnector::InterpretConnector(void)" (?InterpretConnector@CVWScanConnector@@UAEHXZ)
1>VWScanConnector.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CXMLManager::GetFolderPath(long)" (__imp_?GetFolderPath@CXMLManager@@QAE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@J@Z) referenced in function "public: virtual int __thiscall CVWScanConnector::Refresh(long)" (?Refresh@CVWScanConnector@@UAEHJ@Z)
1>VWScanConnector.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CXMLManager::GetDocumentPath(long)" (__imp_?GetDocumentPath@CXMLManager@@QAE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@J@Z) referenced in function "public: virtual int __thiscall CVWScanConnector::DeleteDocument(long)" (?DeleteDocument@CVWScanConnector@@UAEHJ@Z)
1>VWScanConnector.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CXMLManager::GetPagePath(long)" (__imp_?GetPagePath@CXMLManager@@QAE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@J@Z) referenced in function "public: virtual int __thiscall CVWScanConnector::DeletePage(long,long)" (?DeletePage@CVWScanConnector@@UAEHJJ@Z)
1>VWScanConnector.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall CLog::SetLogParameters(wchar_t const *,int,unsigned long,unsigned long)" (__imp_?SetLogParameters@CLog@@QAEXPB_WHKK@Z) referenced in function "public: virtual void __thiscall CVWScanConnector::SetTechLogPath(wchar_t const *,int)" (?SetTechLogPath@CVWScanConnector@@UAEXPB_WH@Z)
1>VWScanConnector.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CRegistry::DeleteValue(wchar_t const *)" (__imp_?DeleteValue@CRegistry@@QAEHPB_W@Z) referenced in function "private: int __thiscall CVWScanConnector::RemoveRegFolder(class CRegistry *,class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >,unsigned long)" (?RemoveRegFolder@CVWScanConnector@@AAEHPAVCRegistry@@V?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@K@Z)
1>C:\Program Files\Contentverse Client\system\Scan.Con : fatal error LNK1120: 17 unresolved externals

2 个答案:

答案 0 :(得分:0)

正如Michael Walz所说,你需要链接依赖库和dll来修复链接器错误。

为了在Visual Studio中执行此操作

在项目上右键单击 - &gt;选择属性 - &gt;点击并展开配置属性 - &gt;选择链接器 - &gt;在链接器下选择输入 在右侧编辑附加依赖项字段以添加libs / dll所在的路径。

修改:

检查this

答案 1 :(得分:0)

也许为时已晚,但我遇到了类似的问题,这是通过在stdafx.h中执行此操作来解决的。

template class __declspec(dllimport) CStringT<char, class StrTraitMFC_DLL<char, class ATL::ChTraitsCRT<char> > >;

在你的情况下,我在猜测

template class __declspec(dllimport) CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >

也许其他人可能会根据您的错误日志...

干杯

修改:

检查this

相关问题