<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Vcpkg on kenji.blog</title><link>http://kenji.blog/zh-tw/tags/vcpkg/</link><description>Recent content in Vcpkg on kenji.blog</description><generator>Hugo -- gohugo.io</generator><language>zh-tw</language><copyright>kenjinote</copyright><lastBuildDate>Mon, 07 Jul 2025 21:46:08 +0900</lastBuildDate><atom:link href="http://kenji.blog/zh-tw/tags/vcpkg/index.xml" rel="self" type="application/rss+xml"/><item><title>【初學者指南】使用 vcpkg 在 Visual Studio 中安裝 libcurl（支援 OpenSSL）的步驟</title><link>http://kenji.blog/zh-tw/p/vcpkg-%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6-visual-studio-%E3%81%AB-curl-%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB/</link><pubDate>Mon, 07 Jul 2025 21:46:08 +0900</pubDate><guid>http://kenji.blog/zh-tw/p/vcpkg-%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6-visual-studio-%E3%81%AB-curl-%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB/</guid><description>&lt;img src="http://kenji.blog/p/vcpkg-%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6-visual-studio-%E3%81%AB-curl-%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB/img.png" alt="Featured image of post 【初學者指南】使用 vcpkg 在 Visual Studio 中安裝 libcurl（支援 OpenSSL）的步驟" />&lt;h2 id="如果您要在-visual-studio-中使用-libcurl支援-openssl強烈推薦引入-vcpkg非常簡單">如果您要在 Visual Studio 中使用 libcurl（支援 OpenSSL），強烈推薦引入 vcpkg，非常簡單
&lt;/h2>&lt;p>在 C++ 中處理 HTTP 通訊時，經常會使用 libcurl。但是，編譯和調整相依性卻意外地麻煩，對吧？&lt;/p>
&lt;p>這時候能派上用場的就是微軟開發的 C++ 函式庫管理工具 ** 「vcpkg」 ** 。
這次我們將介紹如何使用 cpkg 來引入 libcurl（支援 OpenSSL），並讓它在 Visual Studio 中能順暢使用的步驟。&lt;/p>
&lt;hr>
&lt;h3 id="vcpkg-的安裝僅限尚未安裝者">vcpkg 的安裝（僅限尚未安裝者）
&lt;/h3>&lt;p>首先，我們來安裝 cpkg. 請在 PowerShell 中執行以下步驟。&lt;/p>
&lt;p>&lt;code>powershell git clone https://github.com/microsoft/vcpkg cd vcpkg .ootstrap-vcpkg.bat &lt;/code>&lt;/p>
&lt;p>※如果您還沒安裝 Git，請到 &lt;a class="link" href="https://git-scm.com/" target="_blank" rel="noopener"
>Git 官方網站&lt;/a> 進行安裝。&lt;/p>
&lt;hr>
&lt;h3 id="libcurl支援-openssl的安裝">libcurl（支援 OpenSSL）的安裝
&lt;/h3>&lt;p>接著，使用 vcpkg 來安裝 libcurl. 為了指定支援 OpenSSL 的 64 位元版本，請執行以下命令。&lt;/p>
&lt;p>&lt;code>powershell vcpkg install curl[ssl] --triplet x64-windows &lt;/code>&lt;/p>
&lt;p>執行此命令後，必要的相依性（如 OpenSSL）也會被自動設定好。&lt;/p>
&lt;hr>
&lt;h3 id="與-visual-studio-的整合設定">與 Visual Studio 的整合設定
&lt;/h3>&lt;p>為了讓在 vcpkg 引入的函式庫能從 Visual Studio 專案中輕鬆使用，請使用下列命令進行整合設定。&lt;/p>
&lt;p>&lt;code>powershell vcpkg integrate install &lt;/code>&lt;/p>
&lt;p>設定好之後，在 Visual Studio 的專案中就能自動使用 #include &amp;lt;curl/curl.h&amp;gt;，不再需要手動設定函式庫的路徑或連結器。&lt;/p>
&lt;hr>
&lt;h2 id="結語">結語
&lt;/h2>&lt;p>至此，在 Visual Studio 中引入 libcurl（支援 OpenSSL）的準備工作就完成了。&lt;/p>
&lt;ul>
&lt;li>只要使用 vcpkg，就能一次管理所有麻煩的相依性&lt;/li>
&lt;li>使用 cpkg install curl[ssl] &amp;ndash;triplet x64-windows 輕鬆引入 libcurl&lt;/li>
&lt;li>使用 cpkg integrate install 即可與 Visual Studio 進行自動整合&lt;/li>
&lt;/ul>
&lt;p>接下來，只要在專案中包含標頭檔，並使用 libcurl 的 API 就能開始開發了。
請善用方便的 vcpkg，一口氣提升您的開發效率吧。&lt;/p></description></item></channel></rss>