嗨,我正在尝试安装Curl:http://curl.haxx.se/download.html,Dev C++,到目前为止尚未实现,有人可以解释如何在Dev C++中安装Curl吗?
首先..\curl-7.40.0-devel-mingw64\include从下载的包中复制文件夹C:\Dev-Cpp\MinGW64\include然后复制libraries file (.o,.a,.lib)到..\curl-7.40.0-devel-mingw64\lib64文件夹里面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;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Dev-c++ 5.11 (gcc 4.9.2)和curl-7.40.0-devel-mingw64.
| 归档时间: |
|
| 查看次数: |
4175 次 |
| 最近记录: |