curlpp on Ubuntu 9.04

Hey,

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).

Thanks!
Download this: http://curlpp.googlecode.com/files/curlpp-0.7.2.tar.gz

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.

Good luck!
Last edited on
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*, unsigned int, 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!
Thanks to this thread: http://www.mail-archive.com/[email protected]/msg00002.html I almost have curlpp up and running. I've did some things different then stated in the thread: I've replaced examples 18 and 13 with a simple:
1
2
3
4
5
6
#include <iostream>

int main()
{
    return 0;
}


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....

What did I do wrong?
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:

> man gcc
Last edited on
closed account (S6k9GNh0)
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.
Last edited on
I've tried it using pkg-config, but it didn't make any difference.

 
gcc -o simple simple.cpp $(pkg-config --libs --cflags curlpp)


Errors are still the same..

@seymore

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 ;-)
You need to compile with the library path, library name, and include directory path
Make sure all your paths are correct
 
g++ -o simple simple.cpp -L/usr/local/lib/ -lcurlpp -I/usr/local/include
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


On this script:

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
41
42
43
/**
* \file
* The most simple example.
*
*/

#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>


using namespace 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;
}


All the includes files exists in the directories I allready mentioned..
Hope this helps solving the problem.
Last edited on
No other ideas?
why you don't install g++ ? sudo apt-get install build-essential
I've never used curlpp, but looking here: http://api.curlpp.org/namespaces.html

It doesn't seem like there is a curlpp::options namespace... is that an example provided by curlpp.org?
Last edited on
Thanks to this thread: http://www.mail-archive.com/[email protected]/msg00002.html I almost have curlpp up and running. I've did some things different then stated in the thread: I've replaced examples 18 and 13 with a simple:


I have the same problem. I tried renaming example 13 and 18, but still i have the same problem. Any ideas?
curlpp example:

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
/**
 *  main.cpp
 * 
 * The most simple example.
 *
 * 2009/11/04
 * Notes:   Distro: Archlinux
 *              curlpp version:  0.7.2-4
 *              Compiled with "g++ main.cpp -lcurlpp"
 */
#include <iostream>
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>

using namespace cURLpp ; // notice the uppercase
using namespace Options ; // notice the uppercase
using namespace std ;

int main( int , char ** ) {

    try {

        /* Our request to be sent */
        Easy myRequest ;

        /* Set the options */
        myRequest.setOpt( Url( "http://www.google.com" ) ) ;

        /* Perform request */
        myRequest.perform( ) ;

    } catch ( RuntimeError & e ) {
        cout << e.what( ) << endl ;
    } catch ( LogicError & e ) {
        cout << e.what( ) << 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.
Topic archived. No new replies allowed.