Help regarding download from a URL in cpp

Hello All,

I want to download some content from a URL on server(videos/images).

I am not able to start. Please provide me some pointers from where to start.

Thanks in advance.
Could you please help me in locating the header files for this?
You have to download them.

http://curl.haxx.se/download.html
Hi ...

I tried compiling the first code...but it gave an error.
I am unable to figure out the error....

Could yo please help?



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[root@localhost examples]# ls
10-at-a-time.c      curlx.c           ftpgetinfo.c       ghiper.c            https.c           Makefile.inc           multi-single.c       postit2.c       sepheaders.c         smtp-tls.c
anyauthput.c        debug.c           ftpgetresp.c       hiperfifo.c         imap.c            Makefile.m32           multithread.c        progressfunc.c  simple.c             synctime.c
cacertinmem.c       evhiperfifo.c     ftpupload.c        htmltidy.c          Makefile          Makefile.netware       opensslthreadlock.c  README          simplepost.c         threaded-ssl.c
certinfo.c          externalsocket.c  ftpuploadresume.c  htmltitle.cc        Makefile.am       multi-app.c            persistant.c         resolve.c       simplesmtp.c         url2file.c
chkspeed.c          fileupload.c      ftp-wildcard.c     httpcustomheader.c  makefile.dj       multi-debugcallback.c  pop3s.c              rtsp.c          simplessl.c          version-check.pl
cookie_interface.c  fopen.c           getinfo.c          http-post.c         Makefile.example  multi-double.c         pop3slist.c          sampleconv.c    smooth-gtk-thread.c
curlgtk.c           ftpget.c          getinmemory.c      httpput.c           Makefile.in       multi-post.c           post-callback.c      sendrecv.c      smtp-multi.c
[root@localhost examples]# 
[root@localhost examples]# 
[root@localhost examples]# 
[root@localhost examples]# 
[root@localhost examples]# g++ -g 10-at-a-time.c 
/tmp/ccl5BXnC.o: In function `init':
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:101: undefined reference to `curl_easy_init'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:103: undefined reference to `curl_easy_setopt'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:104: undefined reference to `curl_easy_setopt'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:105: undefined reference to `curl_easy_setopt'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:106: undefined reference to `curl_easy_setopt'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:107: undefined reference to `curl_easy_setopt'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:109: undefined reference to `curl_multi_add_handle'
/tmp/ccl5BXnC.o: In function `main':
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:122: undefined reference to `curl_global_init'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:124: undefined reference to `curl_multi_init'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:128: undefined reference to `curl_multi_setopt'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:135: undefined reference to `curl_multi_perform'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:142: undefined reference to `curl_multi_fdset'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:147: undefined reference to `curl_multi_timeout'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:176: undefined reference to `curl_easy_getinfo'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:178: undefined reference to `curl_easy_strerror'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:179: undefined reference to `curl_multi_remove_handle'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:180: undefined reference to `curl_easy_cleanup'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:172: undefined reference to `curl_multi_info_read'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:193: undefined reference to `curl_multi_cleanup'
/home/anubhav/curl-7.26.0/docs/examples/10-at-a-time.c:194: undefined reference to `curl_global_cleanup'
collect2: ld returned 1 exit status
[root@localhost examples]# 


What linker options do I need when I link with libcurl?

$ curl-config --libs


What compiler options do I need when I compile using libcurl functions?

$ curl-config --cflags


...


How do I build a single file with a one-line command?

$ `curl-config --cc --cflags` -o example example.c `curl-config --libs`

http://curl.haxx.se/libcurl/using/curl-config.html
Topic archived. No new replies allowed.