c++ – Libcurl connection

Question:

It's not the first hour I've been connecting libcurl under RadStudio XE. I downloaded the latest version, added #include "curl/curl.h" , got the lib-file from the libcurl.dll library – added it to the project. Dropped 4 dlls in system32:

  • libcurl
  • zlib1
  • libeay32.dll
  • ssleay32.dll

The builder issues a link error

[ILINK32 Error] Error: Unresolved external '_curl_easy_init' referenced from D: …

And stuff like that … What can fix this problem?

Answer:

You need to write macros

#define CURL_STATICLIB

Then include libcurl.lib ws2_32.lib Wldap32.lib and #include <curl\curl.h> It should work.

Here is a visual example

#define CURL_STATICLIB
#pragma comment( lib, "libcurl.lib" )
#pragma comment( lib, "ws2_32.lib" )
#pragma comment( lib, "Wldap32.lib" )
#include <curl\curl.h>
Scroll to Top