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!
views:
242answers:
1
+1
A:
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
2009-12-09 04:48:58
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
2009-12-09 05:11:02
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<PathToLibrary> 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
2009-12-09 05:37:21
Thx Duck u Da Man!
hdx
2009-12-09 09:36:02