I've managed to install libcurl and curl on my Ubuntu 9.04 system. But now I want to install curlpp @ www.curlpp.org. But I can't find any reference on how to do it on a LINUX system. (I need it, because I want to use C++ instead of C).
Then, in the terminal, navigate to where you downloaded that file (if you're unfamiliar with the terminal, the command ls will LiSt the contents of the current directory, cd will Change Directories, and pwd will Print the Working Directory (show what directory you're in). Execute these commands when you get there:
tar -xvvf curlpp-0.7.2.tar.gz
cd curlpp-0.7.2
./configure
If at the end of that last command, if you get errors, then attempt to install the packages that it mentions as missing (via sudo apt-get install <package-name>) Then run again. Do this until all errors are gone. If the errors persist and you don't know what to do, just post the errors here. When that command is successful, run these commands:
make
sudo make install
After this, you should have the files installed correctly, and ready to be used. Post back if you encounter any problems.
Configuring was all right, I had to install libboost, and all problems we're fixed. But the make command gave a couple of errors:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
make[2]: Entering directory `/home/rogier/Desktop/curlpp-0.7.2/utilspp/singleton'
if /bin/bash ../../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../curlpp -g -W -Wall -Werror -I/usr/include -MT LifetimeLibrary.lo -MD -MP -MF ".deps/LifetimeLibrary.Tpo" -c -o LifetimeLibrary.lo LifetimeLibrary.cpp; \
then mv -f ".deps/LifetimeLibrary.Tpo" ".deps/LifetimeLibrary.Plo"; else rm -f ".deps/LifetimeLibrary.Tpo"; exit 1; fi
In file included from LifetimeWithLongevity.hpp:54,
from SingletonHolder.hpp:31,
from LifetimeLibrary.cpp:1:
LifetimeWithLongevity.inl: In function 'void utilspp::setLongevity(T*, unsignedint, TDestroyer)':
LifetimeWithLongevity.inl:19: error: 'upper_bound' is not a member of 'std'
LifetimeLibrary.cpp: In member function 'void utilspp::LifetimeLibraryImpl::add(utilspp::PrivateMembers::LifetimeTracker*)':
LifetimeLibrary.cpp:29: error: 'upper_bound' is not a member of 'std'
make[2]: *** [LifetimeLibrary.lo] Error 1
make[2]: Leaving directory `/home/rogier/Desktop/curlpp-0.7.2/utilspp/singleton'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/rogier/Desktop/curlpp-0.7.2/utilspp'
make: *** [all-recursive] Error 1
I can't find any reference to a package in there, I have totally no idea what to do.. can you help me out again? Thanks!
And I think everything compiled well. So I tried to link the curlpp library in my Code::Blocks IDE. It seems like its in /usr/local/lib/libcurlpp.so or something. So in the linker tab from Settings > Debugger & Compiler I've added this one. In the search directories tab, I've added /usr/local/include/ to the compiler, and /usr/local/lib/ to the linker tab. But it keeps on saying curl/curlpp.hpp directory or file cannot be found, when I try to compile a file requiring those headers....
I've never used this library or an IDE but the first thing I would do is find curl/curlpp.hpp. Then verify that there is a -I[that path] in the compile command line.
With g++, some of the more common things to pay attention to during compilation are -L[lib path] -l[lib] -I[inc path]. For more information, try:
A lot of the time, packages like this can be configured using pkg-config. Pretty useful tool if ya ask me. Also, I suggest your research autoconf, automake, makefiles, and configuration scripts.
I'm using an IDE, can I see those -L[lib path] things in the compiler window of the IDE too, or do I've to compile it like: gcc -o simple simple.cpp
I'll look up some things on gcc in the terminal. Btw it isn't really a package, it's a tarball (or is that the same thing :P) not a deb file or something ;-)
I've tried that but the same errors remain... I lost the error that says: /curl/curlpp.hpp not found, but I still get all the other "not declared" errors...
I've also tried to copy the includes and the library to the normal path (which works with libcurl) /usr/include/ and /usr/lib/ but that didn't work either :S
I'm getting these errors now:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
simple.cpp:12: error: ‘curlpp’ has not been declared
simple.cpp:12: error: ‘options’ is not a namespace-name
simple.cpp:12: error: expected namespace-name before ‘;’ token
simple.cpp: In function ‘int main(int, char**)’:
simple.cpp:19: error: ‘curlpp’ has not been declared
simple.cpp:19: error: expected `;' before ‘myCleanup’
simple.cpp:22: error: ‘curlpp’ has not been declared
simple.cpp:22: error: expected `;' before ‘myRequest’
simple.cpp:25: error: ‘myRequest’ was not declared in this scope
simple.cpp:25: error: ‘Url’ was not declared in this scope
simple.cpp:32: error: expected type-specifier before ‘curlpp’
simple.cpp:32: error: expected `)' before ‘::’ token
simple.cpp:32: error: expected `{' before ‘::’ token
simple.cpp:32: error: ‘::RuntimeError’ has not been declared
simple.cpp:32: error: ‘e’ was not declared in this scope
simple.cpp:32: error: expected `;' before ‘)’ token
simple.cpp:37: error: expected primary-expression before ‘catch’
simple.cpp:37: error: expected `;' before ‘catch’
/**
* \file
* The most simple example.
*
*/
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
usingnamespace curlpp::options;
int main(int, char **)
{
try
{
// That's all that is needed to do cleanup of used resources (RAII style).
curlpp::Cleanup myCleanup;
// Our request to be sent.
curlpp::Easy myRequest;
// Set the URL.
myRequest.setOpt<Url>("http://example.com");
// Send request and get a result.
// By default the result goes to standard output.
myRequest.perform();
}
catch(curlpp::RuntimeError & e)
{
std::cout << e.what() << std::endl;
}
catch(curlpp::LogicError & e)
{
std::cout << e.what() << std::endl;
}
return 0;
}
Sorry I haven't kept up with this thread. Anyway, post the command line for compiling. We need to see the "gcc or g++ etc etc"-thing that your IDE is using and any errors. If something is "not declared" there is probably a header file missing or its some kind of typo (such as case mentioned above).
Use a case-insensitive grep to try and find where that item actually IS declared, then make sure you are including it.