I'm trying to build a C++ console app in VS2008 using the static curlpp library. The code - which is curlpp example 00 - is as follows:
#include "stdafx.h"
#include <curlpp/curlpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
using namespace curlpp::options;
int main(int, char **)
{
try
{
// Our request to be sent.
curlpp::Easy myRequest;
// Set the URL.
myRequest.setOpt<Url>("http://example.com");
// Send request and get a result.
// By default the result goes to standard output.
myRequest.perform();
}
catch(curlpp::RuntimeError & e)
{
std::cout << e.what() << std::endl;
}
catch(curlpp::LogicError & e)
{
std::cout << e.what() << std::endl;
}
return 0;
}
I've downloaded the source and have my include path pointed to the source include files, but when I try and compile, I get a boatload of errors in the inline files of the type:
definition of dllimport function not allowed
Surely lots of folks have used curlpp with vs2008 and I'm missing something obvious.
Take a look at \include\curlpp\internal\buildconfig.h file where there are the following macros defined
CURLPPAPI
CURLPP_INCLUDE_TEMPLATE_DEFINITIONS
CURLPP_TEMPLATE_EXPLICIT_INSTANTIATION
based on values of these three macros
CURLPP_STATICLIB
BUILDING_CURLPP
CURLPP_SELF_CONTAINED
Read about them in README.win32 file and define above three macros accordingly.
In case you still have a problem let us know.
By the way; today I put current version of curlpp for downloading curlpp-current.2009.05.21
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With