Closed AECCCK closed 1 year ago
最近在我的项目“AECCDAS-DEV”中使用acl-redis。
我已经编译了 lib_acl, lib_protocol 和 lib_acl_cpp ;并且在VS的Configuration Properties>C/C++>General>Additional Include Directories中添加了路径..\lib_acl\include;和\lib_acl_cpp\include;在Linker>Input>Additional Dependencies中添加了 lib_acl_vc2012.lib & lib_acl_cpp_vc2012.lib ;在Linker>General中添加了lib库路径../../../lib/win32和../../../dist/lib/win32;在C++>Preprocessor中定义了ACL_DLL和ACL_CPP_DLL
随后使用Debug模式在win32平台进行编译,编译时报故如下:
Error LNK2019 unresolved external symbol "declspec(dllimport) public: bool thiscall acl::redis_stream::xadd(char const ,class std::map<class acl::string,class acl::string,struct std::less,class std::allocator<struct std::pair<class acl::string const ,class acl::string> > > const &,class acl::string &,char const )" (imp_?xadd@redis_stream@acl@@QAE_NPBDABV?$map@Vstring@acl@@V12@U?$less@Vstring@acl@@@std@@V?$allocator@U?$pair@$$CBVstring@acl@@V12@@std@@@4@@std@@AAVstring@2@0@Z) referenced in function "public: void __thiscall CVTPerformance::CVTHandle(void)" (?CVTHandle@CVTPerformance@@QAEXXZ) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\CVTPerformance.obj 1 Error LNK2019 unresolved external symbol "declspec(dllimport) void cdecl acl::acl_cpp_init(void)" (imp_?acl_cpp_init@acl@@YAXXZ) referenced in function "public: bool thiscall ODBCCVT::InitConnection(void)" (?InitConnection@ODBCCVT@@QAE_NXZ) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\ODBCCVT.obj 1 Error LNK2019 unresolved external symbol "declspec(dllimport) public: bool thiscall acl::redis_string::set(char const ,char const )" (_imp?set@redis_string@acl@@QAE_NPBD0@Z) referenced in function "public: bool thiscall ODBCCVT::SetKeyValue(class acl::redis &,class acl::string,class acl::string)" (?SetKeyValue@ODBCCVT@@QAE_NAAVredis@acl@@Vstring@3@1@Z) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\ODBCCVT.obj 1 Error LNK2019 unresolved external symbol "declspec(dllimport) public: thiscall acl::redis_stream::redis_stream(class acl::redis_client )" (imp_??0redis_stream@acl@@QAE@PAVredis_client@1@@Z) referenced in function "public: void __thiscall ODBCCVT::BindClientandStreamHandle(void)" (?BindClientandStreamHandle@ODBCCVT@@QAEXXZ) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\ODBCCVT.obj 1 Error LNK2019 unresolved external symbol "declspec(dllimport) public: void __thiscall acl::redis_stream::`vbase destructor'(void)" (_imp??_Dredis_stream@acl@@QAEXXZ) referenced in function "public: virtual void thiscall acl::redis_stream::`scalar deleting destructor'(unsigned int)" (??_Gredis_stream@acl@@UAEPAXI@Z) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\ODBCCVT.obj 1 Error LNK2019 unresolved external symbol impinet_pton@12 referenced in function _acl_inet_pton AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_sane_inet.obj) 1 Error LNK2001 unresolved external symbol impinet_pton@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_mylog.obj) 1 Error LNK2001 unresolved external symbol impinet_pton@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_netdb.obj) 1 Error LNK2001 unresolved external symbol impinet_pton@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_rfc1035.obj) 1 Error LNK2019 unresolved external symbol _inet_ntop@16 referenced in function _acl_inet_ntop AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_sane_inet.obj) 1 Error LNK2001 unresolved external symbol _inet_ntop@16 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_dns.obj) 1 Error LNK2001 unresolved external symbol _inet_ntop@16 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_netdb.obj) 1 Error LNK2019 unresolved external symbol impgetaddrinfo@16 referenced in function _open_udp_log AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_mylog.obj) 1 Error LNK2001 unresolved external symbol impgetaddrinfo@16 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_inet_connect.obj) 1 Error LNK2001 unresolved external symbol impgetaddrinfo@16 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_host_port.obj) 1 Error LNK2019 unresolved external symbol impfreeaddrinfo@4 referenced in function _open_udp_log AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_mylog.obj) 1 Error LNK2001 unresolved external symbol impfreeaddrinfo@4 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_inet_connect.obj) 1 Error LNK2001 unresolved external symbol impfreeaddrinfo@4 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_sane_bind.obj) 1 Error LNK2001 unresolved external symbol imp__freeaddrinfo@4 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_netdb.obj) 1 Error LNK2001 unresolved external symbol _WSAPoll@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_read_wait.obj) 1 Error LNK2001 unresolved external symbol _WSAPoll@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_readable.obj) 1 Error LNK2001 unresolved external symbol _WSAPoll@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_write_wait.obj) 1 Error LNK2019 unresolved external symbol impWSAPoll@12 referenced in function _check AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_sane_socketpair.obj) 1 Error LNK2001 unresolved external symbol impWSAPoll@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(events_poll.obj) 1 Error LNK1120 11 unresolved externals AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\Debug\AECCDAS_DEV.exe 1
求解,这种情况怎么处理
解决了: 原因是项目中手动包含了WS2_32.LIB这个库,可能和acl库或者其依赖库有重复包含或者发生了冲突
最近在我的项目“AECCDAS-DEV”中使用acl-redis。
我已经编译了 lib_acl, lib_protocol 和 lib_acl_cpp ;并且在VS的Configuration Properties>C/C++>General>Additional Include Directories中添加了路径..\lib_acl\include;和\lib_acl_cpp\include;在Linker>Input>Additional Dependencies中添加了 lib_acl_vc2012.lib & lib_acl_cpp_vc2012.lib ;在Linker>General中添加了lib库路径../../../lib/win32和../../../dist/lib/win32;在C++>Preprocessor中定义了ACL_DLL和ACL_CPP_DLL
随后使用Debug模式在win32平台进行编译,编译时报故如下:
Error LNK2019 unresolved external symbol "declspec(dllimport) public: bool thiscall acl::redis_stream::xadd(char const ,class std::map<class acl::string,class acl::string,struct std::less,class std::allocator<struct std::pair<class acl::string const ,class acl::string> > > const &,class acl::string &,char const )" (imp_?xadd@redis_stream@acl@@QAE_NPBDABV?$map@Vstring@acl@@V12@U?$less@Vstring@acl@@@std@@V?$allocator@U?$pair@$$CBVstring@acl@@V12@@std@@@4@@std@@AAVstring@2@0@Z) referenced in function "public: void __thiscall CVTPerformance::CVTHandle(void)" (?CVTHandle@CVTPerformance@@QAEXXZ) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\CVTPerformance.obj 1
Error LNK2019 unresolved external symbol "declspec(dllimport) void cdecl acl::acl_cpp_init(void)" (imp_?acl_cpp_init@acl@@YAXXZ) referenced in function "public: bool thiscall ODBCCVT::InitConnection(void)" (?InitConnection@ODBCCVT@@QAE_NXZ) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\ODBCCVT.obj 1
Error LNK2019 unresolved external symbol "declspec(dllimport) public: bool thiscall acl::redis_string::set(char const ,char const )" (_imp?set@redis_string@acl@@QAE_NPBD0@Z) referenced in function "public: bool thiscall ODBCCVT::SetKeyValue(class acl::redis &,class acl::string,class acl::string)" (?SetKeyValue@ODBCCVT@@QAE_NAAVredis@acl@@Vstring@3@1@Z) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\ODBCCVT.obj 1
Error LNK2019 unresolved external symbol "declspec(dllimport) public: thiscall acl::redis_stream::redis_stream(class acl::redis_client )" (imp_??0redis_stream@acl@@QAE@PAVredis_client@1@@Z) referenced in function "public: void __thiscall ODBCCVT::BindClientandStreamHandle(void)" (?BindClientandStreamHandle@ODBCCVT@@QAEXXZ) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\ODBCCVT.obj 1
Error LNK2019 unresolved external symbol "declspec(dllimport) public: void __thiscall acl::redis_stream::`vbase destructor'(void)" (_imp??_Dredis_stream@acl@@QAEXXZ) referenced in function "public: virtual void thiscall acl::redis_stream::`scalar deleting destructor'(unsigned int)" (??_Gredis_stream@acl@@UAEPAXI@Z) AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\ODBCCVT.obj 1
Error LNK2019 unresolved external symbol impinet_pton@12 referenced in function _acl_inet_pton AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_sane_inet.obj) 1
Error LNK2001 unresolved external symbol impinet_pton@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_mylog.obj) 1
Error LNK2001 unresolved external symbol impinet_pton@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_netdb.obj) 1
Error LNK2001 unresolved external symbol impinet_pton@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_rfc1035.obj) 1
Error LNK2019 unresolved external symbol _inet_ntop@16 referenced in function _acl_inet_ntop AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_sane_inet.obj) 1
Error LNK2001 unresolved external symbol _inet_ntop@16 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_dns.obj) 1
Error LNK2001 unresolved external symbol _inet_ntop@16 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_netdb.obj) 1
Error LNK2019 unresolved external symbol impgetaddrinfo@16 referenced in function _open_udp_log AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_mylog.obj) 1
Error LNK2001 unresolved external symbol impgetaddrinfo@16 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_inet_connect.obj) 1
Error LNK2001 unresolved external symbol impgetaddrinfo@16 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_host_port.obj) 1
Error LNK2019 unresolved external symbol impfreeaddrinfo@4 referenced in function _open_udp_log AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_mylog.obj) 1
Error LNK2001 unresolved external symbol impfreeaddrinfo@4 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_inet_connect.obj) 1
Error LNK2001 unresolved external symbol impfreeaddrinfo@4 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_sane_bind.obj) 1
Error LNK2001 unresolved external symbol imp__freeaddrinfo@4 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_netdb.obj) 1
Error LNK2001 unresolved external symbol _WSAPoll@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_read_wait.obj) 1
Error LNK2001 unresolved external symbol _WSAPoll@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_readable.obj) 1
Error LNK2001 unresolved external symbol _WSAPoll@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_write_wait.obj) 1
Error LNK2019 unresolved external symbol impWSAPoll@12 referenced in function _check AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(acl_sane_socketpair.obj) 1
Error LNK2001 unresolved external symbol impWSAPoll@12 AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\AECCDAS_DEV\lib_acl_vc2015d.lib(events_poll.obj) 1
Error LNK1120 11 unresolved externals AECCDAS_DEV D:\devp\AECCDAS\AECCDAS\12 SourceCode\AECCDAS_DEV\Debug\AECCDAS_DEV.exe 1
求解,这种情况怎么处理