您如何正确安装libcurl用于Visual Studio 2017?

发布于 2025-01-26 02:58:58 字数 225 浏览 1 评论 0 原文

我只是从C ++开始,无法弄清楚如何添加库,特别是libcurl。我尝试了一堆教程,但大多数是2013/10或不起作用的。任何人都可以解释一下(最好用标准/非技术英语)来添加图书馆吗?我已经尝试在程序的包含部分和其他依赖项菜单中添加它。

请注意,这是我在3天前大约在3天前问的一个重新提出的问题,但我没有收到任何答复。不确定这是否很容易,我应该把它弄清楚,或者只是被埋葬在许多问题或其他原因中。无论如何,很抱歉重新定位。

I am just starting out in c++ and cannot figure out how to add libraries, in particular libcurl. I tried a bunch of tutorials but most were for 2013/10 or didn't work. Can anyone please explain (Preferably in standard/non technical English) how I can add the library? I have already tried adding it in the include section of the program and in the additional dependencies menu.

Note this is a re-post I asked virtually the same question around 3 days ago to which I received no replies. Not sure if that is because its very easy and I should have figured it out my self, or if it just got buried in a flood of questions, or some other reason. In any case sorry for the re-post.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吲‖鸣 2025-02-02 02:58:58

这是我如何与Visual Studio 2017合作的方式15.9.14:

  1. (最新验证是: https://curl.haxx.se/download/curl-7.70.0.0.0.zip
  2. 文件夹下载的软件包(例如
  3. 提取您选择的 代码>开发人员命令提示VS 2017 (请参阅Windows start菜单或%programData%\ Microsoft \ Windows \ Windows \ start Menu \ Program \ Program \ Visual Studio 2017 \ Visual Studio Tools \ )和<代码> cd to c:\ curl \ winbuild \
  4. 运行 nmake/f makefile.vc mode = static 。这将构建卷曲作为静态库中的 c:\ curl \ build \ libcurl-vc-x86-rease static-ipv6-sspi-winssl \
  5. 在Visual Studio中创建一个新项目(例如A <代码> Windows Console Application )
  6. 在project 属性 - &gt; VC ++目录 - &GT;包括目录添加 c:\ curl \ build \ libcurl-vc-x86-rease static-ipv6-sspi-winssl \ incly
  7. 在project properties-properties-&gt; VC ++目录 - &GT; Library Directories add c:\ curl \ build \ libcurl-vc-x86-rease static-ipv6-sspi-winssl \ lib \ lib \ lib \
  8. 项目 properties中 - &gt;链接器 - &gt;输入 - &gt;其他依赖关系添加 libcurl_a.lib ws2_32.lib crypt32.lib wldap32.lib strumaniz.lib
  9. 尝试构建示例程序:
#define CURL_STATICLIB
#include <curl\curl.h>

int main()
{
    CURL *curl;

    curl = curl_easy_init();
    curl_easy_cleanup(curl);

    return 0;
}

另外,您可以使用vcpkg安装curl:

  1. https://github.com/microsoft/vcpkg/releases (eg https://github.com/microsoft/vcpkg/archive/Archive/2019.09.zip )并将其提取到您选择的文件夹(例如C:\ vcpkg \
  2. )命令提示vs for 2017 (请参阅Windows start菜单或%programData%\ Microsoft \ Windows \ Windows \ Start Menu \ Program \ Program \ Visual Studio 2017 \ Visual Studio Tools \ )和 cd < to c:\ vcpkg \
  3. 运行 bootstrap-vcpkg.bat
  4. Run vcpkg.exe Intertate Intertate intermate intermate
  5. 运行 vcpkg.exe Extert interm curl
  6. 在Visual Studio中创建一个新的C ++项目,您就可以使用 - 尝试以上示例。无需修改项目设置。

Here's how I've got curl to work with Visual Studio 2017 15.9.14:

  1. Download curl zip package from https://curl.haxx.se/download.html (latest verified is: https://curl.haxx.se/download/curl-7.70.0.zip)
  2. Extract downloaded package to a folder of your choice (e.g. C:\curl\)
  3. Open Developer Command Prompt for VS 2017 (see Windows Start menu or %PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\) and cd to C:\curl\winbuild\
  4. Run nmake /f Makefile.vc mode=static. This will build curl as a static library into C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\
  5. Create a new project in Visual Studio (e.g. a Windows Console Application)
  6. In Project Properties -> VC++ Directories -> Include Directories add C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\include\
  7. In Project Properties -> VC++ Directories -> Library Directories add C:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\lib\ there
  8. In Project Properties -> Linker -> Input -> Additional Dependencies add libcurl_a.lib, Ws2_32.lib, Crypt32.lib, Wldap32.lib and Normaliz.lib
  9. Try to build a sample program:
#define CURL_STATICLIB
#include <curl\curl.h>

int main()
{
    CURL *curl;

    curl = curl_easy_init();
    curl_easy_cleanup(curl);

    return 0;
}

Alternatively you can use vcpkg to install curl:

  1. Get latest vcpkg zip file from https://github.com/microsoft/vcpkg/releases (e.g. https://github.com/microsoft/vcpkg/archive/2019.09.zip) and extract it to a folder of your choice (e.g. C:\vcpkg\)
  2. Open Developer Command Prompt for VS 2017 (see Windows Start menu or %PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\) and cd to C:\vcpkg\
  3. Run bootstrap-vcpkg.bat
  4. Run vcpkg.exe integrate install
  5. Run vcpkg.exe install curl
  6. Create a new C++ project in Visual Studio and you're ready to go - try it with the example above. There's no need to modify project settings.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文