cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl_easy_init not defined

From: brubelsabs <brubelsabs_at_googlemail.com>
Date: Fri, 08 Aug 2008 11:36:03 +0200

Cristina Gil wrote:
> Hello!
> Im a newbie in C programming, i have to program an application to use it as a daemon which sends periodically a http request to the server.
>
> Im write this:
>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
> #include <curl/curl.h>
>
> void main(){
> CURL *curl;
> char *url;
>
> url="http://192.168.0.63:80/admin/serverreport.cgi";
> curl = curl_easy_init();
>
> if(curl) {
> curl_easy_setopt(curl,CURLOPT_URL, url);
> curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
> curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
> curl_easy_cleanup(curl);
>
> };
> }
>
> But when I try to compile, gcc -o program program.c,

You prob. haven't told the compiler to use the curl library for linking:
gcc -o program program.c -lcurl

HTH
Mathias
-------------------------------------------------------------------
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 2008-08-08