编译时,出现缺少 curl 问题的解决
来源:互联网 发布:centos 无法打开https 编辑:程序博客网 时间:2024/06/06 20:36
/** Description * Sample project in C using libcurl. * Requests the rate data for EUR/USD, USD/CAD, AND USD/JPY and outputs them to standard output. */#include <stdio.h>#include <curl/curl.h>int main() { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://api-sandbox.oanda.com/v1/prices?instruments=EUR_USD%2CUSD_CAD%2CUSD_JPY"); struct curl_slist *chunk = NULL; // uncomment to add authorization header: not required for sandbox // chunk = curl_slist_append(chunk, "Authorization: Bearer <your access token>"); /* use custom headers */ res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); /* 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); /* free the custom headers */ curl_slist_free_all(chunk); } return 0;}
安装
apt-get install libcurl4-gnutls-dev
编译
gcc APISample.c -lcurl -o rate_fetcher
运行
./rate_fetcher
阅读全文
0 0
- 编译时,出现缺少 curl 问题的解决
- 编译otad时缺少selinux.h的问题及解决
- 编译otad时缺少selinux.h的问题及解决
- 编译时常出现缺少库的问题以及解决方案
- 怎样解决Qt编译出的程序运行时缺少libgcc_s_dw2-1.dll 文件的问题?
- 关于VS2005编译wince Application 时缺少DLL问题的解决
- 解决使用CURL出现code ERROR 60错误的问题
- CURL抓取网页时出现的问题
- 解决PHP编译cURL的reinstall the libcurl问题
- protobuf 编译iOS,lib curl缺少行 x86_64的解决方法
- 编译Opal时出现大量未定义符号问题的解决
- 如何解决编译Qt及Qvfb时出现的问题
- 编译 sfilter 出现的问题与解决
- 解决编译faplayer出现的一揽子问题
- 编译时出现缺少 Python.h 错误
- VS2008编译缺少atlrx.h的解决
- VS2008编译缺少atlrx.h的解决
- VS2008编译缺少atlrx.h的解决
- MongoDB-创建索引
- java 继承的隐藏与覆盖典例
- 一些C文件函数fseek(),ftell(),rewind()
- 如何删除win7自带的微软拼音输入法
- Linux : 添加交换空间
- 编译时,出现缺少 curl 问题的解决
- LeetCode编程练习
- kettle 抽取数据入库中文乱码
- spring的@RequestParam
- 自己下载 Gradle 并让其生效
- OpenCV程序封装为64位DLL给Java调用
- Unity 播放gif
- windows命令
- MySQL数据库(五)_VS中实现插入MySQL数据实操