cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: how to link during build/compile

From: macaco <macacoangel_at_gmail.com>
Date: Fri, 16 Jan 2009 17:22:51 -0500

>
>
> > 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

That was it,
gcc -L/usr/lib/libcurl.a curlexample.c -lcurl

and worked... thanks.

-------------------------------------------------------------------
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