0

I wanna write a little c++ program using libcurl. It's for a school project so I need to be able to package everything in a zip file and email it to my instructor. I've just downloaded the tar from the libcurl website but now I'm not sure what the next step is... What else do I gotta do in order to be able to do #include "curl/curl.h" and call curl functions from my main function? Once I do that how would I zip it and make sure my instructor will be able to compile it too? I'm using Ubuntu. Any help will be apprecitated!

hdx
  • 4,198
  • 7
  • 26
  • 33

1 Answers1

3

1) Download the source from here.

2) unpack with "tar xvzf tarfilename"

3) cd to newly created directory from the unpack

4) enter "./configure"

5) enter "make" and "make install"

6) write your program and remember to link against the library.

7) When ready to send to prof, I would zip the original libcurl source along with the instructions above and any other you used to get your project to work.

Edit - Something like:

g++ -g -Wall -o myapp myapp.cpp -L/usr/local/lib -lcurl

Duck
  • 26,924
  • 5
  • 64
  • 92
  • Thx a lot! Not sure what to do for step 6... how would I link against the library? Is it in the "g++ -o" command? also, after I do the make install how do I figure out what to put in the #include *** statement? – hdx Dec 09 '09 at 05:11
  • Assuming a very simple program just put the include at the top of your source file (or header file if you have one). For the link use -L and -lcurl toward the end of the g++ command. If you don't want to install lib in the default path look into the --prefix parameter of configure. If you do "./configure --help" it explains a little. Basically you are supplying an alternative directory for make to put the libcurl file. – Duck Dec 09 '09 at 05:37