visual studio 2012中的各种链接器错误

时间:2014-04-26 10:58:46

标签: c++ visual-studio-2012 linker lnk2019 lnk2001

我正在为我们提供一些.lib文件的学校作业。我在链接器中添加了它们,但我仍然遇到链接器错误。当我将它们更改为不同的路径时,我得到一个文件未找到错误。我的错误是:

Error   53  error LNK2019: unresolved external symbol "__declspec(dllimport)    public: __thiscall sql::SQLString::~SQLString(void)" (__imp_??1SQLString@sql@@QAE@XZ) referenced in function "public: static class std::vector<class Address *,class std::allocator<class Address *> > __cdecl AddressDAO::findAddressByCity(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?findAddressByCity@AddressDAO@@SA?AV?$vector@PAVAddress@@V?$allocator@PAVAddress@@@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)    C:\Users\Kenny\Documents\software project\Groep 6\Docs\Dev-Branch-Kenny\KiaDealer\KiaDealer\AddressDAO.obj
Error   54  error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::~SQLString(void)" (__imp_??1SQLString@sql@@QAE@XZ)  C:\Users\Kenny\Documents\software project\Groep 6\Docs\Dev-Branch-Kenny\KiaDealer\KiaDealer\DatabaseSingleton.obj
Error   55  error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0SQLString@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: static class std::vector<class Address *,class std::allocator<class Address *> > __cdecl AddressDAO::findAddressByCity(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?findAddressByCity@AddressDAO@@SA?AV?$vector@PAVAddress@@V?$allocator@PAVAddress@@@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z) C:\Users\Kenny\Documents\software project\Groep 6\Docs\Dev-Branch-Kenny\KiaDealer\KiaDealer\AddressDAO.obj
Error   56  error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(char const * const)" (__imp_??0SQLString@sql@@QAE@QBD@Z) referenced in function "public: static class std::vector<class Address *,class std::allocator<class Address *> > __cdecl AddressDAO::findAddressByCity(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?findAddressByCity@AddressDAO@@SA?AV?$vector@PAVAddress@@V?$allocator@PAVAddress@@@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)   C:\Users\Kenny\Documents\software project\Groep 6\Docs\Dev-Branch-Kenny\KiaDealer\KiaDealer\AddressDAO.obj
Error   57  error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(char const * const)" (__imp_??0SQLString@sql@@QAE@QBD@Z)  C:\Users\Kenny\Documents\software project\Groep 6\Docs\Dev-Branch-Kenny\KiaDealer\KiaDealer\DatabaseSingleton.obj
Error   58  error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::operator class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &(void)const " (__imp_??BSQLString@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "public: static class std::vector<class Address *,class std::allocator<class Address *> > __cdecl AddressDAO::findAddressByCity(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?findAddressByCity@AddressDAO@@SA?AV?$vector@PAVAddress@@V?$allocator@PAVAddress@@@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z)    C:\Users\Kenny\Documents\software project\Groep 6\Docs\Dev-Branch-Kenny\KiaDealer\KiaDealer\AddressDAO.obj
Error   59  error LNK2019: unresolved external symbol __imp__get_driver_instance referenced in function "private: __thiscall DatabaseSingleton::DatabaseSingleton(void)" (??0DatabaseSingleton@@AAE@XZ) C:\Users\Kenny\Documents\software project\Groep 6\Docs\Dev-Branch-Kenny\KiaDealer\KiaDealer\DatabaseSingleton.obj
Error   60  error LNK1120: 5 unresolved externals   C:\Users\Kenny\Documents\software project\Groep 6\Docs\Dev-Branch-Kenny\KiaDealer\Debug\KiaDealer.exe

我无法编译。我甚至尝试将项目从unicode更改为其他选项,因为我读到了解决其中一个错误的问题。

编辑,我也收到很多这些警告,这些警告可能是相关的: 警告1警告C4251:'sql :: SQLString :: realStr':class'std :: basic_string&lt; _Elem,_Traits,_Alloc&gt;'需要让dll接口供类'sql :: SQLString'的客户端使用'c:\ users \ kenny \ documents \ software project \ groep 6 \ docs \ dev-branch-kenny \ kiadealer \ kiadealer \ include \ cppconn \ sqlstring.h 38

1 个答案:

答案 0 :(得分:1)

它确实编译,但它没有链接,有区别。谷歌搜索后,你似乎没有编译适当的平台;请遵循此thread。进入配置管理器并更改目标平台。