Hi, I'm new to using libcurl and curlpp, and after installing both of
them I try to compile the first example on the curlpp folder and it
brings out this errors.
/tmp/ccrujmu4.o: In function `main':
prueba.cpp:(.text+0x8c): undefined reference to
`curlpp::Cleanup::Cleanup()'
prueba.cpp:(.text+0x97): undefined reference to `curlpp::Easy::Easy()'
prueba.cpp:(.text+0x110): undefined reference to `curlpp::Easy::perform
()'
prueba.cpp:(.text+0x13c): undefined reference to `curlpp::Easy::~Easy
()'
prueba.cpp:(.text+0x155): undefined reference to `curlpp::Easy::~Easy
()'
prueba.cpp:(.text+0x168): undefined reference to
`curlpp::Cleanup::~Cleanup()'
prueba.cpp:(.text+0x184): undefined reference to
`curlpp::Cleanup::~Cleanup()'
/tmp/ccrujmu4.o: In function `void
curlpp::internal::CurlHandle::option<void*>(CURLoption, void*)':
prueba.cpp:
(.text._ZN6curlpp8internal10CurlHandle6optionIPvEEv10CURLoptionT_[void
curlpp::internal::CurlHandle::option<void*>(CURLoption, void*)]+0x1e):
undefined reference to `curl_easy_setopt'
prueba.cpp:
(.text._ZN6curlpp8internal10CurlHandle6optionIPvEEv10CURLoptionT_[void
curlpp::internal::CurlHandle::option<void*>(CURLoption, void*)]+0x36):
undefined reference to `curlpp::libcurlRuntimeAssert(char const*,
CURLcode)'
/tmp/ccrujmu4.o: In function
`curlpp::OptionTrait<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, (CURLoption)10002>::updateHandleToMe
(curlpp::internal::CurlHandle*) const':
prueba.cpp:
(.text._ZNK6curlpp11OptionTraitISsL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE
[curlpp::OptionTrait<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, (CURLoption)10002>::updateHandleToMe
(curlpp::internal::CurlHandle*) const]+0x57): undefined reference to
`curlpp::UnsetOption::UnsetOption(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccrujmu4.o:(.gcc_except_table+0x120): undefined reference to
`typeinfo for curlpp::RuntimeError'
/tmp/ccrujmu4.o:(.gcc_except_table+0x124): undefined reference to
`typeinfo for curlpp::LogicError'
/tmp/ccrujmu4.o: In function `curlpp::UnsetOption::~UnsetOption()':
prueba.cpp:(.text._ZN6curlpp11UnsetOptionD1Ev
[curlpp::UnsetOption::~UnsetOption()]+0x17): undefined reference to
`curlpp::RuntimeError::~RuntimeError()'
/tmp/ccrujmu4.o: In function `curlpp::UnsetOption::~UnsetOption()':
prueba.cpp:(.text._ZN6curlpp11UnsetOptionD0Ev
[curlpp::UnsetOption::~UnsetOption()]+0x17): undefined reference to
`curlpp::RuntimeError::~RuntimeError()'
/tmp/ccrujmu4.o: In function `curlpp::Option<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >::getValue() const':
prueba.cpp:(.text._ZNK6curlpp6OptionISsE8getValueEv
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::getValue() const]+0x57): undefined reference
to `curlpp::UnsetOption::UnsetOption(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccrujmu4.o: In function `curlpp::Option<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >::updateMeToOption
(curlpp::OptionBase const&)':
prueba.cpp:
(.text._ZN6curlpp6OptionISsE16updateMeToOptionERKNS_10OptionBaseE
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::updateMeToOption(curlpp::OptionBase const&)]
+0x2a): undefined reference to `typeinfo for curlpp::OptionBase'
prueba.cpp:
(.text._ZN6curlpp6OptionISsE16updateMeToOptionERKNS_10OptionBaseE
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::updateMeToOption(curlpp::OptionBase const&)]
+0x66): undefined reference to `curlpp::UnsetOption::UnsetOption(char
const*)'
/tmp/ccrujmu4.o: In function `curlpp::Option<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >::~Option()':
prueba.cpp:(.text._ZN6curlpp6OptionISsED2Ev
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::~Option()]+0x4d): undefined reference to
`curlpp::OptionBase::~OptionBase()'
prueba.cpp:(.text._ZN6curlpp6OptionISsED2Ev
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::~Option()]+0x66): undefined reference to
`curlpp::OptionBase::~OptionBase()'
/tmp/ccrujmu4.o: In function `curlpp::Option<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >::~Option()':
prueba.cpp:(.text._ZN6curlpp6OptionISsED0Ev
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::~Option()]+0x4d): undefined reference to
`curlpp::OptionBase::~OptionBase()'
prueba.cpp:(.text._ZN6curlpp6OptionISsED0Ev
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::~Option()]+0x66): undefined reference to
`curlpp::OptionBase::~OptionBase()'
/tmp/ccrujmu4.o: In function `curlpp::Option<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >::~Option()':
prueba.cpp:(.text._ZN6curlpp6OptionISsED1Ev
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::~Option()]+0x4d): undefined reference to
`curlpp::OptionBase::~OptionBase()'
/tmp/ccrujmu4.o:prueba.cpp:(.text._ZN6curlpp6OptionISsED1Ev
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::~Option()]+0x66): more undefined references
to `curlpp::OptionBase::~OptionBase()' follow
/tmp/ccrujmu4.o: In function `curlpp::Option<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >::Option(CURLoption,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&)':
prueba.cpp:(.text._ZN6curlpp6OptionISsEC2E10CURLoptionRKSs
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::Option(CURLoption, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)]+0x15):
undefined reference to `curlpp::OptionBase::OptionBase(CURLoption)'
prueba.cpp:(.text._ZN6curlpp6OptionISsEC2E10CURLoptionRKSs
[curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >::Option(CURLoption, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)]+0x4e):
undefined reference to `curlpp::OptionBase::~OptionBase()'
/tmp/ccrujmu4.o:
(.rodata._ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE[vtable for
curlpp::OptionTrait<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, (CURLoption)10002>]+0x10): undefined reference
to `curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
/tmp/ccrujmu4.o:(.rodata._ZTIN6curlpp6OptionISsEE[typeinfo for
curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >]+0x8): undefined reference to `typeinfo for
curlpp::OptionBase'
/tmp/ccrujmu4.o:(.rodata._ZTIN6curlpp11UnsetOptionE[typeinfo for
curlpp::UnsetOption]+0x8): undefined reference to `typeinfo for
curlpp::RuntimeError'
/tmp/ccrujmu4.o:(.rodata._ZTVN6curlpp6OptionISsEE[vtable for
curlpp::Option<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >]+0x10): undefined reference to
`curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
collect2: ld returned 1 exit status
*************************************************
The code I'm using is this one:
/**
* \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://www.google.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;
}
**********************************************************
Could anyone please help me, I don't know if I'm missing something or
doing something wrong.
Thanks in advance