如何正确使用NYUGET以及libcurl

Nuget是一个.NET平台下的开源的项目,它是Visual Studio的扩展。在使用Visual Studio开发基于.NET Framework的应用时,Nuget能把在项目中添加、移除和更新引用的工作变得更加快捷方便。
注意:这种方法只能自己在电脑上拉,不能拷贝库到别的地方。
在vs2015中装好以后,具体百度很简单。

然后在工程目录中右键点击管理nuget包,然后输入想要的包下载,
一般下载到当前工作目录下的package包中,包括头文件,
下载libcur,openssl,
三个库一个不能少,另外地址也要加上去
在这里插入图片描述

// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//

#include “stdafx.h”
#include <stdio.h>
#include <curl/curl.h>
#include <wincrypt.h>//一定要包含
#pragma comment(lib,“ws2_32.lib”)//wldap32.lib
#pragma comment(lib,“wldap32.lib”)//libcrypto.lib
#pragma comment(lib,“Crypt32.lib”)//libssl.lib
其余在属性设置就可以 了

//#pragma comment(lib,“libssl.lib”)

int main()
{

CURL *curl;
CURLcode res;

/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);

/* get a curl handle */
curl = curl_easy_init();
if (curl) {
	/* First set the URL that is about to receive our POST. This URL can
	just as well be a https:// URL if that is what should receive the
	data. */
	curl_easy_setopt(curl, CURLOPT_URL, "http://postit.example.com/moo.cgi");
	/* Now specify the POST data */
	curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl");

	/* 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);
}
curl_global_cleanup();
return 0;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值