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;
}