問題起因
近一段時間有了解到Boost 1.82.0新添加了MySQL庫,最近一直蠢蠢欲動想要試一下這個庫
所以就下載了源碼并進行了編譯(過程比較簡單,有文檔的)
然后在VS2022中引入了Boost環(huán)境,然后粘了一下文檔中的一小段代碼:
//#include "boost/mysql.hpp"
#include "iostream"
#include "boost/asio.hpp"
#include "boost/asio/ssl.hpp"
#include "boost/mysql.hpp"
int main()
{
// The execution context, required to run I/O operations.
boost::asio::io_context ctx;
// The SSL context, required to establish TLS connections.
// The default SSL options are good enough for us at this point.
boost::asio::ssl::context ssl_ctx(boost::asio::ssl::context::tls_client);
// Represents a connection to the MySQL server.
boost::mysql::tcp_ssl_connection conn(ctx.get_executor(), ssl_ctx);
return 0;
}
然后編譯一下就有了這樣的報錯:
無法打開 源 文件 “openssl/conf.h”…
問題解決
第一時間反應(yīng)是因為沒有安裝openssl,于是乎就下載了一個openssl, url:https://slproweb.com/products/Win32OpenSSL.html
安裝了之后并在安裝目錄下找到了include
和 lib
并配置到了Visual Studio當(dāng)中
鏈接器輸入選項中也配置了三個以來的.lib
文件結(jié)果還是有這樣的問題
臨時解決方案
-
找到
openssl
安裝路徑下的include\openssl
復(fù)制該文件夾 -
找到VS2022的安裝路徑,找到:
VC\Tools\MSVC\14.36.32532\include
拷貝到下面
重新編譯項目,即可通過文章來源:http://www.zghlxwxcb.cn/news/detail-607710.html
(windows下開發(fā)環(huán)境配置稍微麻煩一丟丟)文章來源地址http://www.zghlxwxcb.cn/news/detail-607710.html
到了這里,關(guān)于Visual Studio2022報錯 無法打開 源 文件 “openssl/conf.h“解決方式的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!