c++ - C++ curl如何使用?

标签 c++ curl

我是C++的初学者,想知道如何在我的项目中使用curl。我在Windows上使用https://github.com/dacap/pocketcpp。我在互联网上搜索了如何包含curl,但是找不到任何简单的答案...

到目前为止,这是我得到的:

#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>


using namespace curlpp::options;

int main(int, char **)
{
    try
    {
        curlpp::Cleanup myCleanup;

        curlpp::Easy myRequest;

        myRequest.setOpt<Url>("https://google.com");
        myRequest.perform();
    }

    catch(curlpp::RuntimeError & e)
    {
        std::cout << e.what() << std::endl;
    }

    catch(curlpp::LogicError & e)
    {
        std::cout << e.what() << std::endl;
    }

  return 0;
}

但是我收到以下错误:
In file included from I:\C-CPP\workspace\backdoor.cpp:1:0:
I:\C-CPP\pocketcpp\MinGW\include/curlpp/cURLpp.hpp:33:10: fatal error: curl/curl.h: No such file or directory
 #include <curl/curl.h>
          ^~~~~~~~~~~~~
compilation terminated.

最佳答案

通过pocketcpp链接,您提供了:

In next versions you'll be able to link multiple .cpp files and to use third party libraries



嗯是的。看起来,使用Pocketcpp只能执行一个cpp文件的编译。使用成熟的IDE,例如Visual Sudio,Visual Studio Code,Eclipse,Code::Blocks等。

关于c++ - C++ curl如何使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52776638/

相关文章:

c++ - Qt 包含文件

c++ - OpenGL 天空盒未在相机上绘制

c++ - 私有(private)成员与私有(private)继承

php - CURL 返回完整的字符串响应而不是 xml

php - 使用 PHP 获取重定向 URL 的最快方法

c++ - 这将打印出什么,为什么?你会怎么修? [C++]

html - 使用 CURL 获取 XML 格式的网页数据

java - curl -d 我如何在 Java 中使用 HTTP?

c++ - cURL 显示 SSLv3 而不是 TLSv1

c++ - 实现 OpenSceneGraph 时在 Qt 中获取引用问题