cURL / Mailing Lists / curl-library / Single Mail

curl-library

[Errors undefined reference]

From: Frederic Weisbecker <frederic.weisbecker_at_wanadoo.fr>
Date: Sat, 30 Apr 2005 17:12:02 +0200

Hello!

I am a beginner in C programming. And i start to use libcurl.

Here is my source code:

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

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

int main(void)
{
    CURL *easyhandle;
    FILE *test;
   
    size_t write_data(void *buffer,size_t size,size_t nmemb,void
*userp); /* Function not described but I think the problem is elsewhere
at this moment */
    curl_global_init(CURL_GLOBAL_ALL);
    easyhandle=curl_easy_init();
   
    curl_easy_setopt(easyhandle,CURLOPT_URL,"http://www.google.fr");
    curl_easy_setopt(easyhandle,CURLOPT_WRITEFUNCTION,write_data);
    curl_easy_setopt(easyhandle,CURLOPT_WRITEDATA,test);
    curl_easy_perform(easyhandle);
   
    printf("\n");
    return 0;
}

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

My problem occures during the compilation. I have this message from gcc:

/tmp/ccajJGAq.o(.text+0x18): In function `main':
: undefined reference to `curl_global_init'
/tmp/ccajJGAq.o(.text+0x1d): In function `main':
: undefined reference to `curl_easy_init'
/tmp/ccajJGAq.o(.text+0x3b): In function `main':
: undefined reference to `curl_easy_setopt'
/tmp/ccajJGAq.o(.text+0x43): In function `main':
: undefined reference to `write_data'
/tmp/ccajJGAq.o(.text+0x56): In function `main':
: undefined reference to `curl_easy_setopt'
/tmp/ccajJGAq.o(.text+0x70): In function `main':
: undefined reference to `curl_easy_setopt'
/tmp/ccajJGAq.o(.text+0x7b): In function `main':
: undefined reference to `curl_easy_perform'
collect2: ld a retourné 1 code d'état d'exécution /* In english: ld
returned 1 code's state of execution (or something like that :-) */

I work with debian sarge with these packages: Curl-7.13.2 (last source
code release), libcurl3_7.13.2-2, libcurl3-dev_7.13.2-2

I can't understand my error because I have the headers of libcurl in
/usr/include/curl and I think I have normally included those headers on
my source code...

Do you have a suggestion?

Thanks....
Received on 2005-04-30