【问题标题】:Install Curl in Dev C++ [closed]在 Dev C++ 中安装 Curl [关闭]
【发布时间】:2015-10-16 04:45:12
【问题描述】:

您好,我正在尝试安装 Curl:http://curl.haxx.se/download.html,Dev C++ 到目前为止还没有实现,有人可以解释如何在 Dev C++ 中安装 Curl 吗?

【问题讨论】:

  • 您好,您能否详细说明您尝试过的操作以及安装失败的原因?
  • Dev C++ 是一个 IDE。您可能需要先安装 cURL,然后告诉 Dec C++ 在安装目录中查找,我希望。
  • 哪个 dev-c++ 版本?

标签: c++ dev-c++


【解决方案1】:

首先将下载包中的..\curl-7.40.0-devel-mingw64\include文件夹复制到C:\Dev-Cpp\MinGW64\include,然后将..\curl-7.40.0-devel-mingw64\lib64文件夹中的libraries file (.o,.a,.lib)复制到C:\Dev-Cpp\MinGW64\lib,然后编译第一个程序,不要忘记链接libcurl.a

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

 int main(void)
 {
    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if(curl) 
    {
       curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
       /* example.com is redirected, so we tell libcurl to follow redirection */
       curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

       /* Perform the request, res will get the return code */
       res = curl_easy_perform(curl);
       /* Check for errors */
       if(res != CURLE_OK)
       fprintf(stderr, "curl_easy_perform() failed: %s\n",
       curl_easy_strerror(res));

       /* always cleanup */
       curl_easy_cleanup(curl);
    }
  return 0;
 }

我正在使用Dev-c++ 5.11 (gcc 4.9.2)curl-7.40.0-devel-mingw64

【讨论】:

  • 很好,感谢您的帮助。如果有人无法通过代码,您必须将以下内容添加到链接器 dll "libcurldll.a"
猜你喜欢
  • 2023-03-21
  • 1970-01-01
  • 1970-01-01
  • 2017-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-18
相关资源
最近更新 更多