cURL / Mailing Lists / curl-users / Single Mail

curl-users

how to link during build/compile

From: Mauricio Camayo <mauricio.camayo_at_gmail.com>
Date: Fri, 16 Jan 2009 15:43:33 -0500

I know this is a noob question, but don't know how to do it.

I have this example code:

#include <stdio.h>
#include <curl/curl.h>

int main(void)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}

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.

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