cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl undeclared first use in this function

From: mailbox20112002-SED <mailbox20112002-SED_at_yahoo.it>
Date: Fri, 2 Aug 2013 13:05:47 +0200

Hi

Thanks to reply

I try to make a small program for download jpg images.

Curl on my pc, is installed properly?
Look pkg-config:
G:\MinGW\bin>pkg-config libcurl --libs --cflags
@CPPFLAG_CURL_STATICLIB@ -IG:/MinGW/include -LG:/MinGW/lib -lcurl

With this codes show error:

/****
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>

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

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
    /* example.com is redirected, so we tell libcurl to follow redirection
*/
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);
    /* Check for errors */
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));

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

G:\MinGW\bin\mingw32-gcc.exe -IG:\MinGW\include -LG:\MinGW\lib -lcurl -lcrypto
 -lidn -lrtmp -lssh2 -lz -o simple.exe simple.c
G:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccucOm20.o:simple.c:(.text+0x2b):
undefined r
eference to `_imp__curl_easy_init'
G:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccucOm20.o:simple.c:(.text+0x55):
undefined r
eference to `_imp__curl_easy_setopt'
G:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccucOm20.o:simple.c:(.text+0x72):
undefined r
eference to `_imp__curl_easy_setopt'
G:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccucOm20.o:simple.c:(.text+0x7f):
undefined r
eference to `_imp__curl_easy_perform'
G:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccucOm20.o:simple.c:(.text+0x95):
undefined r
eference to `_imp__curl_easy_strerror'
G:\DOCUME~1\ADMINI~1\IMPOST~1\Temp/ccucOm20.o:simple.c:(.text+0xbe):
undefined r
eference to `_imp__curl_easy_cleanup'
collect2: ld returned 1 exit status

***/

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-08-02