我在编码方面一点新鲜感。我想把libcurl库添加到我的visual studio项目中,我认为我做得对,但我不确定。我怎么会在页眉丢失方面出现错误?
#include <curl/curl.h>
#include <libxml/HTMLparser.h>我添加了引用->Manage包->和libcurl.net库的库
但是,我在编译时仍然有错误。另外,我也有一个警告,也许问题是来自
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 这是我的代码的一部分
#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;同时,我也发现了许多相同的话题,并且读得很好,但我不知道我的问题在哪里。
另外,对于另一个问题,我的目标是从在线页面中获得一个简单的字符串!你知道有一种更好更容易得到字符串的方法吗?
发布于 2017-05-30 19:53:54
您应该为编译器提供到libcurl头文件的路径(在Project->Properties->C/C++->General->Additional Include Directories中指定它),为链接器提供到libcurl.lib (与libcurl.dll配对)的路径(在Project->Properties->Linker->Input->Additional Dependencies处指定)。
https://stackoverflow.com/questions/44270038
复制相似问题