C++ cannot pass objects of non-POD type C++ cannot pass objects of non-POD type curl curl

C++ cannot pass objects of non-POD type


The problem you have is that variable argument functions do not work on non-POD types, including std::string. That is a limiation of the system and cannot be modified. What you can, on the other hand, is change your code to pass a POD type (in particular a pointer to a nul terminated character array):

curl_easy_setopt(curl, CURLOPT_URL, url.c_str());


As the warning indicates, std::string is not a POD-type, and POD-types are required when calling variadic-argument functions (i.e., functions with an ... argument).

However, char const* is appropriate here; change

curl_easy_setopt(curl, CURLOPT_URL, url);

to

curl_easy_setopt(curl, CURLOPT_URL, url.c_str());