简体   繁体   中英

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 . 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

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 )。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM