cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ld.exe: cannot find -lcurl

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Tue, 31 Jul 2012 09:46:18 +0200

"Chris Ch" <charch86_at_gmail.com> wrote:

>I am trying to compile a simple program which uses libcurl with Mingw using
> Msys. Here is my command and the output given:
>
> Chris_at_Chris-HP ~
> $ gcc -L/usr/local/lib/libcurl.a -o live live.c -DCURL_STATICLIB
> -I/usr/local/include -lcurl
> c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe:
> cannot find -lcurl

The '-L' option (ld search-path) is supposed to contain a directory
(not a file). IMHO it's better to explicitly tell the linker what lib to use;

gcc -o live live.c -DCURL_STATICLIB -I/usr/local/include /usr/local/lib/libcurl.a

Since (on Windows at least), if you use '-lcurl', GNU ld will use 'libcurl.dll.a' if both
libcurl.dll.a and libcurl.a are present in the same directory. Very annoying.

--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-31