我已经从BoostPro下载了 Boost 1.51 版。安装程序似乎有点不稳定,但我想我设法下载了大部分 1.51 文件。对于丢失的文件,我找到了另一个链接并设法下载了其余的文件。我还下载了 OpenSSL 版本 j 64 位版本。我正在尝试从此示例客户端代码构建代码。链接器生成 51 个未解决的外部错误。以下是前 20 个,看起来至少与其他人抱怨的错误有些相似:
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _ERR_reason_error_string referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall boost::asio::error::detail::ssl_category::message(int)const " (?message@ssl_category@detail@error@asio@boost@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _ERR_get_error referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv23_server_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv23_client_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv23_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _TLSv1_server_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _TLSv1_client_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _TLSv1_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv3_server_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv3_client_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv3_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv2_server_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv2_client_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSL_CTX_new referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSLv2_method referenced in function "public: __thiscall boost::asio::ssl::context::context(enum boost::asio::ssl::context_base::method)" (??0context@ssl@asio@boost@@QAE@W4method@context_base@123@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSL_CTX_free referenced in function "public: __thiscall boost::asio::ssl::context::~context(void)" (??1context@ssl@asio@boost@@QAE@XZ)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSL_CTX_set_ex_data referenced in function "public: __thiscall boost::asio::ssl::context::~context(void)" (??1context@ssl@asio@boost@@QAE@XZ)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSL_CTX_get_ex_data referenced in function "public: __thiscall boost::asio::ssl::context::~context(void)" (??1context@ssl@asio@boost@@QAE@XZ)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSL_CTX_set_verify referenced in function "public: class boost::system::error_code __thiscall boost::asio::ssl::context::set_verify_mode(int,class boost::system::error_code &)" (?set_verify_mode@context@ssl@asio@boost@@QAE?AVerror_code@system@4@HAAV564@@Z)
1>TestBoostASIO.obj : error LNK2019: unresolved external symbol _SSL_CTX_get_verify_callback referenced in function "public: class boost::system::error_code __thiscall boost::asio::ssl::context::set_verify_mode(int,class boost::system::error_code &)" (?set_verify_mode@context@ssl@asio@boost@@QAE?AVerror_code@system@4@HAAV564@@Z)
我在这里阅读了有关将 Boost 与 OpenSSL 链接的问题的其他问题,并尝试了解决问题的建议步骤。这包括:
- 将路径 C:\OpenSSL-Win64\include 添加到附加包含目录。
- 将 C:\OpenSSL-Win64\lib\VC\static 添加到附加库目录。也尝试过指定 C:\OpenSSL-Win64\lib\VC\ 路径,结果相同。
- 将 libeay32MDd.lib 和 ssleay32MDd.lib 添加到 Additional Dependencies 以用于链接器附加依赖项。
即使在完成上述操作后,我仍然会收到这些链接错误。我还尝试使用 __stdcall 而不是默认的 __cdecl 构建我的项目 - 这会在调用信号时出现编译错误,该信号需要 __cdecl; 所以我不认为是这样。我已经尝试了我能想到的一切。有没有人知道我做错了什么或者我可以尝试什么来解决问题?