cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: how to get the libcurl up and running in my C code.

From: goeie spullen <goeiespullen_at_gmail.com>
Date: Thu, 3 Feb 2011 20:52:04 +0100

Hi Alan, thanx for you quick reply. The issue is that I don't get the
complilation up and running:

I downloaded the following file and tried to compile it:
https://github.com/bagder/curl/raw/master/docs/examples/ftpupload.c

itops_at_itops-laptop:~/development/preventel/code/ftpclient$ cc ftptest4.c
/tmp/ccvb2cjd.o: In function `main':
ftptest4.c:(.text+0x178): undefined reference to `curl_global_init'
ftptest4.c:(.text+0x17d): undefined reference to `curl_easy_init'
ftptest4.c:(.text+0x1a9): undefined reference to `curl_slist_append'
ftptest4.c:(.text+0x1c7): undefined reference to `curl_slist_append'
ftptest4.c:(.text+0x1fb): undefined reference to `curl_easy_setopt'
ftptest4.c:(.text+0x228): undefined reference to `curl_easy_setopt'
ftptest4.c:(.text+0x255): undefined reference to `curl_easy_setopt'
ftptest4.c:(.text+0x285): undefined reference to `curl_easy_setopt'
ftptest4.c:(.text+0x2af): undefined reference to `curl_easy_setopt'
/tmp/ccvb2cjd.o:ftptest4.c:(.text+0x2de): more undefined references to
`curl_easy_setopt' follow
/tmp/ccvb2cjd.o: In function `main':
ftptest4.c:(.text+0x2ed): undefined reference to `curl_easy_perform'
ftptest4.c:(.text+0x303): undefined reference to `curl_slist_free_all'
ftptest4.c:(.text+0x312): undefined reference to `curl_easy_cleanup'
ftptest4.c:(.text+0x326): undefined reference to `curl_global_cleanup'
collect2: ld returned 1 exit status

Then I try to find the location of the library and force the compiler to
search trough the path:

itops_at_itops-laptop:~/development/preventel/code/ftpclient$ locate
curl/curl.h
/usr/include/curl/curl.h
itops_at_itops-laptop:~/development/preventel/code/ftpclient$ cc
-I/usr/include/ ftptest4.c
/tmp/cc1cuFvq.o: In function `main':
ftptest4.c:(.text+0x178): undefined reference to `curl_global_init'
ftptest4.c:(.text+0x17d): undefined reference to `curl_easy_init'
ftptest4.c:(.text+0x1a9): undefined reference to `curl_slist_append'
ftptest4.c:(.text+0x1c7): undefined reference to `curl_slist_append'
ftptest4.c:(.text+0x1fb): undefined reference to `curl_easy_setopt'
ftptest4.c:(.text+0x228): undefined reference to `curl_easy_setopt'
ftptest4.c:(.text+0x255): undefined reference to `curl_easy_setopt'
ftptest4.c:(.text+0x285): undefined reference to `curl_easy_setopt'
ftptest4.c:(.text+0x2af): undefined reference to `curl_easy_setopt'
/tmp/cc1cuFvq.o:ftptest4.c:(.text+0x2de): more undefined references to
`curl_easy_setopt' follow
/tmp/cc1cuFvq.o: In function `main':
ftptest4.c:(.text+0x2ed): undefined reference to `curl_easy_perform'
ftptest4.c:(.text+0x303): undefined reference to `curl_slist_free_all'
ftptest4.c:(.text+0x312): undefined reference to `curl_easy_cleanup'
ftptest4.c:(.text+0x326): undefined reference to `curl_global_cleanup'
collect2: ld returned 1 exit status
itops_at_itops-laptop:~/development/preventel/code/ftpclient$

Cheers,
Maarten

2011/2/3 Alan Wolfe <alan.wolfe_at_gmail.com>

> Heya,
>
> http://curl.haxx.se/libcurl/c/example.html
>
> I googled "libcurl FTP tutorial" and it was the 2nd result.
>
> The first result might also be of interest to you but ::shrug:: this link
> has the example code you were looking for.
>
> On Thu, Feb 3, 2011 at 6:12 AM, goeie spullen <goeiespullen_at_gmail.com>wrote:
>
>> Hi, Let me introduce myself, I am a project manager that wants to know
>> what is going on under the hood. I studied Ansi C for a small year now. Just
>> started with Bjarne Stoustup's c++ book. All great but now the real stuff.
>> I'm busy with a C code program that does some validation on a text file. All
>> this is up and running. When ok I want to be able to FTP the file. For this
>> I want to use libcurl library but I don't get it up and running.
>>
>> I have been reading on the curl website for some time now but a small
>> example program would help me a lot.
>>
>> Does anyone know where I can find a simple example program where a file is
>> put over ftp. I have allready installed the libdev stuff (sudo apt-get
>> install ftplib-dev) on my ubuntu box.
>>
>> Cheers,
>> Maarten
>>
>>
>>
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>>
>
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-03