cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Compilation problem [Was: Question regarding correct libcurl's license usage]

From: Claes Jakobsson <claes_at_versed.se>
Date: Sun, 20 Sep 2009 21:34:00 +0200

On Sep 20, 2009, at 9:16 PM, Иван Иванов wrote:
> Im trying to compile simple.c from http://curl.haxx.se/libcurl/c/simple.html
>
> And when i wrote
> $ cc curl.c
> /tmp/ccuqDzha.o: In function `main':
> curl.c:(.text+0x8a): undefined reference to `curl_easy_init'
> curl.c:(.text+0xb4): undefined reference to `curl_easy_setopt'
> curl.c:(.text+0xbf): undefined reference to `curl_easy_perform'
> curl.c:(.text+0xcd): undefined reference to `curl_easy_cleanup'
> collect2: ld returned 1 exit status
>
>
> what's wrong ?

Please don't top-post or steal email threads.

You are not linking with libcurl which is why you're getting those
errors. If you're using GCC or something with compatible-ish args pass
-l<name of lib> as in "cc -lcurl curl.c"

you might also want to pass "-o simple" so you end up with a
executable named simple instead of a.out (if you're using gcc)

Cheers,
Claes
Received on 2009-09-20