Reputation: 307
So I've been messing around with libcurlpp doing things like trying to download HTML files or HTTP POST requests but I always get around 4 errors like
1>MyProgram.obj : error LNK2001: unresolved external symbol __imp__curl_easy_init
1>MyProgram.obj : error LNK2001: unresolved external symbol __imp__curl_easy_setopt
1>MyProgram.obj : error LNK2001: unresolved external symbol __imp__curl_easy_perform
1>MyProgram.obj : error LNK2001: unresolved external symbol __imp__curl_easy_cleanup
And the one time I actually got it to compile whenever I run it I get SEVERAL DLL errors even if I move the proper DLL's into the folder with my executable the compiler spits out more errors about ?PDB's? if I remember properly
Any who I'm done with libcurl for now could anyone suggest something else preferably well documented because I'm pretty new at this.
And yes I've already searched for something with little results. Much thanks in advance!!!
EDIT: Got it to work using SFML Thanks guys!
Upvotes: 0
Views: 958
Reputation: 103703
I use SFML. It's a multi-media library, mainly intended for game development, but it happens to have facilities for processing HTTP. It's very easy to use, the following downloads this page:
#include <iostream>
#include <SFML/Network.hpp>
int main()
{
sf::Http Http("stackoverflow.com");
sf::Http::Request req("/questions/9892198/something-other-than-libcurl");
sf::Http::Response page = Http.SendRequest(req);
std::cout << page.GetBody();
}
Of course, there's a little more work to be done if you want to handle more complex situations like redirects.
Upvotes: 1
Reputation: 168626
For comparison, here is the trivial Poco program:
#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
#include <iostream>
using namespace Poco::Net;
int main () {
HTTPClientSession session("stackoverflow.com");
HTTPRequest request("GET", "/questions/9892198/something-other-than-libcurl");
HTTPResponse response;
session.sendRequest(request);
std::cout << session.receiveResponse(response).rdbuf();
}
Upvotes: 0