我不知道為什么以下指令會崩潰:
boost::asio::ssl::context ctx(boost::asio::ssl::context::tlsv12);
我收到以下錯誤:行程回傳 -1073741819 (0xC0000005)
關于例外沒有什么可捕獲的,AFAIK 的 boost 檔案沒有提到 boost 和 openssl 版本之間的不兼容問題。
我的環境:
來自 cygwin 的 gcc:C:\cygwin64\x86_64-w64-mingw32-g .exe
聯結器選項:-lws2_32 -lcrypto -lssl
使用 boost 1.78(來自網站的 dl)和 cygwin 的 openssl 1.1.1m 包
這是最小的例子:
#include <iostream>
#include <boost/asio/ssl/context.hpp>
int main()
{
std::cout << "before" << std::endl;
try {
boost::asio::ssl::context ctx(boost::asio::ssl::context::tlsv12);
} catch (...) {
std::cout << "catch" << std::endl;
}
std::cout << "after" << std::endl;
return 0;
}
輸出:
before
uj5u.com熱心網友回復:
我安裝的 openssl cygwin 包不是一個穩定的包,所以缺少 include 和 lib 檔案,而且我使用了錯誤的包(與 x86_64-w64-mingw32-g 編譯器不兼容)。我已經安裝了另一個穩定版本,并且現在可以使用所需的檔案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/443380.html
