【问题标题】:Curl with vcpkg使用 vcpkg 卷曲
【发布时间】:2020-06-08 16:00:55
【问题描述】:

我正在使用远程 wsl 使用 wsl-2 开发 Windows 10 我正在尝试使用 vcpkg 附加一个外部库 我安装的一个 Trail pacakge 有效 但卷曲不起作用

#include <iostream>
#include <curl/curl.h>

using namespace std;

int main()
{
   cout<<"hello";
}

这给了我错误

1. #include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/mnt/d/projectsc++/scrap/main.cpp).
2. cannot open source file "curl/curl.h"
3. curl/curl.h: No such file or directory

但是当我尝试运行时

./vcpkg install curl

它显示 curl 已经安装和配置。

 Computing installation plan...
 The following packages are already installed:
 curl[core,non-http,openssl,ssl]:x64-linux
 Package curl:x64-linux is already installed

 Total elapsed time: 36.7 us

 The package curl:x64-linux provides CMake targets:

find_package(CURL CONFIG REQUIRED)
target_link_libraries(main PRIVATE CURL::libcurl)

我对此很陌生,所以我不了解其中的大部分内容,但有人可以解释我在做什么错误...

【问题讨论】:

    标签: c++ visual-studio-code windows-subsystem-for-linux vscode-remote vcpkg


    【解决方案1】:

    find_package 通常应该找到包含目录。但是看看是否在你的 find_package 命令之后添加以下作品。

    include_directories(${CURL_INCLUDE_DIRS})

    【讨论】:

      猜你喜欢
      • 2017-03-05
      • 1970-01-01
      • 1970-01-01
      • 2011-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      相关资源
      最近更新 更多