cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: how to link during build/compile

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 16 Jan 2009 14:02:28 -0800

On Fri, Jan 16, 2009 at 03:43:33PM -0500, Mauricio Camayo wrote:
> I know this is a noob question, but don't know how to do it.
[...]
> and try to build/compile using:
>
> $>gcc -c -g curlexample.c
> $> gcc -lcurl curlexample.o -o curlexample.exe
>
> but get this errors:
>
> undefined reference to `_curl_easy_init`
> undefined reference to `_curl_easy_setopt`
> undefined reference to `_curl_easy_perform`
> undefined reference to `_curl_easy_cleanup`
>
> I'm under cygwin, have download and installed the curl, libcurl4 and curl-devel
> I suppose there's a problem during the link of libcurl, but can't figure it
> out.

Try moving the -lcurl to the end of the gcc command line. You may also need
to add a flag -L/path/to/libcurl.a to indicate where the libcurl library
is located.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-01-16