fork download
  1. // CurlHandler.hpp
  2. #include <memory>
  3. #include <curl/curl.h>
  4.  
  5. class CurlHandler {
  6. private:
  7. std::unique_ptr<CURL, decltype(&curl_easy_cleanup)> curl_;
  8.  
  9. public:
  10. /*CurlHandler() : curl_(curl_easy_init(), curl_easy_cleanup);*/
  11. CurlHandler();
  12. ~CurlHandler();
  13. };
  14.  
  15. // CurlHandler.cpp
  16. CurlHandler::CurlHandler() {
  17. curl_ = std::unique_ptr<CURL, decltype(&curl_easy_cleanup)>(curl_easy_init(), curl_easy_cleanup);
  18. }
  19.  
  20. //ERROR
  21. src/CurlHandler.cpp: In constructor ‘CurlHandler::CurlHandler():
  22. src/CurlHandler.cpp:3:26: error: no matching function for call to ‘std::unique_ptr<void, void (*)(void*)>::unique_ptr()
  23. 3 | CurlHandler::CurlHandler() {
  24.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:10: fatal error: curl/curl.h: No such file or directory
 #include <curl/curl.h>
          ^~~~~~~~~~~~~
compilation terminated.
stdout
Standard output is empty