0

I did everything as it's written here: cURL with Visual Studio 2013. Visual showed such errors:

unresolved external symbol __imp__curl_easy_setopt

unresolved external symbol __imp__curl_easy_perform

unresolved external symbol __imp__curl_easy_cleanup

unresolved external symbol __imp__curl_easy_init`

I think it's problem with libcurl.lib but I don't have idea what I do wrong... Include and library directories added as can been seen on this screenshot:

enter image description here

libcurl.lib also added...

enter image description here

Example code to run:

#include <iostream>
#include <stdio.h> 
#include <curl/curl.h>


int main(void)
{
    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if (curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
        res = curl_easy_perform(curl);

        /* always cleanup */
        curl_easy_cleanup(curl);
    }
    return 0;
}

I spent a lot of time to search how can I add curl to my project, when there is real hope, once again had something doesn't work...

Community
  • 1
  • 1
Larson
  • 3
  • 2

2 Answers2

0

As I see you forgot Step 3 from cURL with Visual Studio 2013:

Make sure you choose Release as configuration (top left corner)!

In your screenshot, you applied the settings on Debug configuration.

Community
  • 1
  • 1
MrAnno
  • 754
  • 5
  • 17
0

In file curl.h you can find this snippet

#ifdef CURL_STATICLIB
#  define CURL_EXTERN
#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
#  if defined(BUILDING_LIBCURL)
#    define CURL_EXTERN  __declspec(dllexport)
#  else
#    define CURL_EXTERN  __declspec(dllimport)
#  endif
#elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
#  define CURL_EXTERN CURL_EXTERN_SYMBOL
#else
#  define CURL_EXTERN
#endif

Therefore if you are linking against a static version of curl , you have to define CURL_STATICLIB before the #include <curl/curl.h>

albertoCaroM
  • 46
  • 1
  • 3