cURL / Mailing Lists / curl-users / Single Mail

curl-users

curl_getinfo.c

From: Swapnil Ashtekar <swapashtekar_at_gmail.com>
Date: Thu, 17 Mar 2011 14:56:49 +0530

Hey,

    I am novice to curl and libcurl. I want to run following code.

#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://www.google.co.in/");

    res = curl_easy_perform(curl);

    if(CURLE_OK == res) {
      char *ct;

      res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);

      if((CURLE_OK == res) && ct)
        printf("We received Content-Type: %s\n", ct);
    }

    curl_easy_cleanup(curl);
  }
  return 0;
}

-----------------------------------------------------------------------------

The error gcc is giving while compiling is,

swapnil_at_swapnil-Studio-1558:~/workdir/filesys/curl/curl-7.21.3/swa$ gcc
getinfo.c
/tmp/ccxVEWth.o: In function `main':
getinfo.c:(.text+0x82): undefined reference to `curl_easy_init'
getinfo.c:(.text+0xb5): undefined reference to `curl_easy_setopt'
getinfo.c:(.text+0xc1): undefined reference to `curl_easy_perform'
getinfo.c:(.text+0xf0): undefined reference to `curl_easy_getinfo'
getinfo.c:(.text+0x124): undefined reference to `curl_easy_cleanup'
collect2: ld returned 1 exit status

I want this program to be compiled using arm_v5t_le-gcc,
the terminal is showing following,

swapnil_at_swapnil-Studio-1558:~/workdir/filesys/curl/curl-7.21.3/swa$
arm_v5t_le-gcc getinfo.c
getinfo.c:3:23: curl/curl.h: No such file or directory
getinfo.c: In function `main':
getinfo.c:7: error: `CURL' undeclared (first use in this function)
getinfo.c:7: error: (Each undeclared identifier is reported only once
getinfo.c:7: error: for each function it appears in.)
getinfo.c:7: error: `curl' undeclared (first use in this function)
getinfo.c:8: error: `CURLcode' undeclared (first use in this function)
getinfo.c:8: error: parse error before "res"
getinfo.c:14: error: `CURLOPT_URL' undeclared (first use in this function)
getinfo.c:16: error: `res' undeclared (first use in this function)
getinfo.c:18: error: `CURLE_OK' undeclared (first use in this function)
getinfo.c:22: error: `CURLINFO_CONTENT_TYPE' undeclared (first use in this
function)

Please help me out.

Thanks in advance.

-- 
Cheers
Regards,
Swapnil Ashtekar

-------------------------------------------------------------------
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 2011-03-17