cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to build libcurl

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Thu, 20 Aug 2009 16:44:04 +0200

On Thursday 20 of August 2009 16:30:07 sumana ts wrote:
> Hi,
> Even if i try "gcc -L /usr/lib/libcurl.so myapp.c",also throws undefined
> symbol reference.
> As long as iam using '-lcurl' option,everything works fine(either libcurl
> source or the linux installed libcurl).
>
> I feel '-L' is to link to the specified library and -lcurl is the option
> which tells the linker to pick the symbols from curl which are
> not there in the library path specified with '-L'.So in both the cases
> whether i build libcurl on my own or take from the OS,
> i have to use -lcurl.Am i correct?

That's completely wrong!

You should read the manual:
http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Link-Options.html#index-Libraries-888

In your example it would be "gcc myapp.c -lcurl -L/usr/lib". The output is
a.out (if not overridden by -o).

Kamil
Received on 2009-08-20