jpbarrette / curlpp

C++ wrapper around libcURL
http://www.curlpp.org
1.68k stars 360 forks source link

Error LNK2019 unresolved external symbol __imp_curl_easy_setopt #141

Open ruudll opened 2 years ago

ruudll commented 2 years ago

I'm trying to use your Curlpp wrapper around libcurl and it looks very promising. I installed version 0.7.3.1 via Nuget in VS2019 and after adding below, it compiled fine.

define CURLPP_STATICLIB

include <curlpp/cURLpp.hpp>

include <curlpp/Easy.hpp>

include <curlpp/Options.hpp>

Now I'm trying to implement code from your example, but as soon as I use for example the code below it gives me an Unresolved External Symbol.

curlpp::options::Url url(std::string(this->url));

Error LNK2019 unresolved external symbol __imp_curl_easy_setopt referenced in function "public: void __cdecl curlpp::internal::CurlHandle::option<void >(enum CURLoption,void )"

Do you maybe have any clue how to solve this?

Thanks in advance,

sgallou commented 2 years ago

Hi, Curlpp can not find curl library. Check that libcurl.lib (or libcurl-d.lib for debug) exists in your app project settings (linker ==> inputs ==> additional dependencies). Check also the path to theses files.

PiotrKFtw commented 2 years ago

Same error here. I've added libcurl.lib to additional dependencies, also tried other solutions like

pragma comment(lib, "libcurl.lib")

Tried copy pasting libcurl.lib from static folder to another location and include that with no luck. Also c++ 17 completely breaks your library.

sgallou commented 2 years ago

Curlpp 0.7.3.1 is pretty old ! Can you try with the latest version ?

PiotrKFtw commented 2 years ago

I'm using the latest veresion from nuget.

sgallou commented 2 years ago

Seems that push versions to nuget repo is no more maintained...

xCENTx commented 2 years ago

Maybe they should be maintained? Building this project for C++ is kind of a pain in the rear. Nobody wants to install 15 other programs to make a simple http request

Its pretty sad that you can't even complete the first example with the nuget package version of curllpp

myRequest.setOpt<Url>("http://example.com");

the error being "Url"

image

sgallou commented 2 years ago

Can you try replacing Url by curlpp::options::Url, please ?