将DLL添加到特定项目后出现LNK2019错误(通常可以正常工作)

时间:2018-07-16 18:35:21

标签: c++ dll

我有一个名为GMC的dll,其中包括另一个名为nlopt(https://nlopt.readthedocs.io/en/latest/NLopt_on_Windows/)的dll。我可以创建一个控制台,将GMC添加到项目中,然后运行该程序而不会出现任何问题。但是,当我尝试将GMC添加到特定项目时,采取与将其添加到我制作的控制台相同的所有步骤(包括头文件,添加对dll的引用,其他包含目录),我得到了这些{{3} }

在VS2017中工作时,我没有这个问题。由于这个问题不重要,我不得不改用VS2013。最初,我认为这些链接错误是由于我正在使用VS2013中从VS2017创建的DLL引起的。但是,在VS2013中重新创建GMC和nlopt并将它们重新添加到我的项目中之后,仍然存在链接错误。

我还仔细研究了该项目的所有项目属性,并比较了它们与正在运行且没有发现差异的项目的链接错误(所有运行时库都是多线程调试DLL(/ MDd) )。

错误:

Error   57  error LNK2019: unresolved external symbol __imp___hypot referenced in function _hypot   C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   58  error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (__imp_?_Debug_message@std@@YAXPB_W0I@Z) referenced in function "void __cdecl std::_Debug_pointer<char>(char const *,wchar_t const *,unsigned int)" (??$_Debug_pointer@D@std@@YAXPBDPB_WI@Z)   C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   59  error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base12::_Container_base12(void)" (__imp_??0_Container_base12@std@@QAE@XZ) referenced in function "public: __thiscall std::_String_val<struct std::_Simple_types<char> >::_String_val<struct std::_Simple_types<char> >(void)" (??0?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ)   C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   60  error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base12::~_Container_base12(void)" (__imp_??1_Container_base12@std@@QAE@XZ) referenced in function "public: __thiscall std::_String_val<struct std::_Simple_types<char> >::~_String_val<struct std::_Simple_types<char> >(void)" (??1?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ) C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   61  error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base12::_Orphan_all(void)" (__imp_?_Orphan_all@_Container_base12@std@@QAEXXZ) referenced in function "public: void __thiscall std::_String_alloc<0,struct std::_String_base_types<char,class std::allocator<char> > >::_Free_proxy(void)" (?_Free_proxy@?$_String_alloc@$0A@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ) C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   62  error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xbad_alloc(void)" (__imp_?_Xbad_alloc@std@@YAXXZ) referenced in function "char * __cdecl std::_Allocate<char>(unsigned int,char *)" (??$_Allocate@D@std@@YAPADIPAD@Z)   C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   63  error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z) referenced in function "public: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Xlen(void)const " (?_Xlen@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ)   C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   64  error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xout_of_range(char const *)" (__imp_?_Xout_of_range@std@@YAXPBD@Z) referenced in function "public: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Xran(void)const " (?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ)   C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   65  error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::locale::id::id(unsigned int)" (__imp_??0id@locale@std@@QAE@I@Z) referenced in function "void __cdecl `dynamic initializer for 'public: static class std::locale::id std::num_put<char,class std::back_insert_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::id''(void)" (??__E?id@?$num_put@DV?$back_insert_iterator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@std@@2V0locale@2@A@@YAXXZ)    C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   66  error LNK2019: unresolved external symbol "__declspec(dllimport) char const * __cdecl std::_Syserror_map(int)" (__imp_?_Syserror_map@std@@YAPBDH@Z) referenced in function "public: virtual class std::error_condition __thiscall std::_System_error_category::default_error_condition(int)const " (?default_error_condition@_System_error_category@std@@UBE?AVerror_condition@2@H@Z)   C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   67  error LNK2019: unresolved external symbol "__declspec(dllimport) char const * __cdecl std::_Winerror_map(int)" (__imp_?_Winerror_map@std@@YAPBDH@Z) referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::_System_error_category::message(int)const " (?message@_System_error_category@std@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@H@Z)  C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Gsi\Gsi.obj   Gsi
Error   68  error LNK1120: 11 unresolved externals  C:\Users\h6565169\Documents\tps_trunk\G2GsiBridge\Development\Debug\Gsi.exe Gsi

0 个答案:

没有答案
相关问题