[英]Add curl library C++
I'm little new in coding. 我在编码方面并不陌生。 I want to add libcurl library to my visual studio project , I think I do it right but I'm not sure .
我想将libcurl库添加到我的visual studio项目中,我认为我做对了,但不确定。 how ever I have some errors in header missing
我怎么在头文件中缺少一些错误
#include <curl/curl.h>
#include <libxml/HTMLparser.h>
I add the library with References->Manage Nuget packages->and libcurl.net library 我使用参考->管理Nuget包->和libcurl.net库添加该库
but still I have errors on compile. 但我仍然在编译时出错。 also I have a warning too maybe problem is in warning from
我也有警告,也许是警告来自
Severity Code Description Project File Line Suppression State
Warning The 'packages' element is not declared. Project3 C:\Users\Pc\Documents\Visual Studio 2015\Projects\Project3\Project3\packages.config 2
and here is my some part of the code 这是我的部分代码
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <curl/curl.h>
#include <libxml/HTMLparser.h>
//
// Case-insensitive string comparison
//
#ifdef _MSC_VER
#define COMPARE(a, b) (!_stricmp((a), (b)))
#else
#define COMPARE(a, b) (!strcasecmp((a), (b)))
#endif
//
// libxml callback context structure
//
struct Context
{
Context() : addTitle(false) { }
bool addTitle;
std::string title;
};
//
// libcurl variables for error strings and returned data
static char errorBuffer[CURL_ERROR_SIZE];
static std::string buffer;
also I find many same topics and read them well but I don't know where is my problem. 我也找到许多相同的主题,并且读得很好,但我不知道我的问题在哪里。
also for an another question , my goal is get an simple string from an online page ! 还有一个问题,我的目标是从在线页面获得一个简单的字符串! do you know a better and easier way to get an string??
您知道一种更好,更轻松的方法来获取字符串吗?
您应该提供编译器的libcurl
头文件的路径(在Project->Properties->C/C++->General->Additional Include Directories
指定该路径)和libcurl.lib(与libcurl.dll配对) )的链接器(在Project->Properties->Linker->Input->Additional Dependencies
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.