Linker error when using curlpp
GEOEGII555 opened this issue · 0 comments
GEOEGII555 commented
Here's the error:
geoegii555@DESKTOP-HK0PRA8:/<the project folder>$ make
mkdir -p out
g++ -lm -lcurl -lcurlpp -Ofast main.cpp -o out/main
/usr/bin/ld: /tmp/ccbdN6Jc.o: warning: relocation against `_ZTIN6curlpp12RuntimeErrorE' in read-only section `.text.unlikely'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::initialize(long)':
main.cpp:(.text+0x19): undefined reference to `curl_global_init'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::Cleanup::Cleanup()':
main.cpp:(.text+0x4e): undefined reference to `curl_global_init'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::escape(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
main.cpp:(.text+0x9e): undefined reference to `curl_escape'
/usr/bin/ld: main.cpp:(.text+0xcf): undefined reference to `curl_free'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::unescape(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
main.cpp:(.text+0x11e): undefined reference to `curl_unescape'
/usr/bin/ld: main.cpp:(.text+0x14f): undefined reference to `curl_free'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::getenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
main.cpp:(.text+0x198): undefined reference to `curl_getenv'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::libcurlVersion[abi:cxx11]()':
main.cpp:(.text+0x213): undefined reference to `curl_version'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::getdate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, long*)':
main.cpp:(.text+0x2df): undefined reference to `curl_getdate'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `operator<<(std::ostream&, curlpp::OptionTrait<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, (CURLoption)10002> const&)':
main.cpp:(.text+0x5ea): undefined reference to `curlpp::Easy::Easy()'
/usr/bin/ld: main.cpp:(.text+0x5f5): undefined reference to `curlpp::Easy::setOpt(curlpp::OptionBase const&)'
/usr/bin/ld: main.cpp:(.text+0x600): undefined reference to `operator<<(std::ostream&, curlpp::Easy const&)'
/usr/bin/ld: main.cpp:(.text+0x608): undefined reference to `curlpp::Easy::~Easy()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::initialize(long)':
main.cpp:(.text+0x2b): undefined reference to `curlpp::libcurlRuntimeAssert(char const*, CURLcode)'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::terminate()':
main.cpp:(.text+0x35): undefined reference to `curl_global_cleanup'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::Cleanup::Cleanup()':
main.cpp:(.text+0x60): undefined reference to `curlpp::libcurlRuntimeAssert(char const*, CURLcode)'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::UnsetOption::~UnsetOption()':
main.cpp:(.text._ZN6curlpp11UnsetOptionD2Ev[_ZN6curlpp11UnsetOptionD5Ev]+0xf): undefined reference to `curlpp::RuntimeError::~RuntimeError()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::UnsetOption::~UnsetOption()':
main.cpp:(.text._ZN6curlpp11UnsetOptionD0Ev[_ZN6curlpp11UnsetOptionD5Ev]+0x13): undefined reference to `curlpp::RuntimeError::~RuntimeError()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::OptionTrait<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, (CURLoption)10002>::updateHandleToMe(curlpp::internal::CurlHandle*) const':
main.cpp:(.text._ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE[_ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE]+0x23): undefined reference to `curl_easy_setopt'
/usr/bin/ld: main.cpp:(.text._ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE[_ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE]+0x4e): undefined reference to `curlpp::UnsetOption::UnsetOption(char const*)'
/usr/bin/ld: main.cpp:(.text._ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE[_ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE]+0x32): undefined reference to `curlpp::libcurlRuntimeAssert(char const*, CURLcode)'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::OptionTrait<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, (CURLoption)10002>::~OptionTrait()':
main.cpp:(.text._ZN6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EED2Ev[_ZN6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EED5Ev]+0x5d): undefined reference to `curlpp::OptionBase::~OptionBase()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::Option<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::updateMeToOption(curlpp::OptionBase const&)':
main.cpp:(.text._ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE16updateMeToOptionERKNS_10OptionBaseE[_ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE16updateMeToOptionERKNS_10OptionBaseE]+0x1e): undefined reference to `typeinfo for curlpp::OptionBase'
/usr/bin/ld: main.cpp:(.text._ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE16updateMeToOptionERKNS_10OptionBaseE[_ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE16updateMeToOptionERKNS_10OptionBaseE]+0x22c): undefined reference to `curlpp::UnsetOption::UnsetOption(char const*)'
/usr/bin/ld: main.cpp:(.text._ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE16updateMeToOptionERKNS_10OptionBaseE[_ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE16updateMeToOptionERKNS_10OptionBaseE]+0x297): undefined reference to `curlpp::UnsetOption::UnsetOption(char const*)'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::OptionTrait<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, (CURLoption)10002>::~OptionTrait()':
main.cpp:(.text._ZN6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EED0Ev[_ZN6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EED5Ev]+0x56): undefined reference to `curlpp::OptionBase::~OptionBase()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::OptionTrait<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, (CURLoption)10002>::clone() const':
main.cpp:(.text._ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE5cloneEv[_ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE5cloneEv]+0x91): undefined reference to `curlpp::OptionBase::OptionBase(CURLoption)'
/usr/bin/ld: main.cpp:(.text._ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE5cloneEv[_ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE5cloneEv]+0x23d): undefined reference to `curlpp::UnsetOption::UnsetOption(char const*)'
/usr/bin/ld: main.cpp:(.text._ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE5cloneEv[_ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE5cloneEv]+0x274): undefined reference to `curlpp::OptionBase::~OptionBase()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::unescape(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) [clone .cold]':
main.cpp:(.text.unlikely+0x81): undefined reference to `curlpp::RuntimeError::RuntimeError(char const*)'
/usr/bin/ld: main.cpp:(.text.unlikely+0x88): undefined reference to `curlpp::RuntimeError::~RuntimeError()'
/usr/bin/ld: main.cpp:(.text.unlikely+0x8f): undefined reference to `typeinfo for curlpp::RuntimeError'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::getenv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) [clone .cold]':
main.cpp:(.text.unlikely+0xea): undefined reference to `curlpp::RuntimeError::RuntimeError(char const*)'
/usr/bin/ld: main.cpp:(.text.unlikely+0xf1): undefined reference to `curlpp::RuntimeError::~RuntimeError()'
/usr/bin/ld: main.cpp:(.text.unlikely+0xf8): undefined reference to `typeinfo for curlpp::RuntimeError'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::libcurlVersion[abi:cxx11]() [clone .cold]':
main.cpp:(.text.unlikely+0x153): undefined reference to `curlpp::RuntimeError::RuntimeError(char const*)'
/usr/bin/ld: main.cpp:(.text.unlikely+0x15a): undefined reference to `curlpp::RuntimeError::~RuntimeError()'
/usr/bin/ld: main.cpp:(.text.unlikely+0x161): undefined reference to `typeinfo for curlpp::RuntimeError'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::getdate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, long*) [clone .cold]':
main.cpp:(.text.unlikely+0x19c): undefined reference to `curlpp::RuntimeError::RuntimeError(char const*)'
/usr/bin/ld: main.cpp:(.text.unlikely+0x1a3): undefined reference to `curlpp::RuntimeError::~RuntimeError()'
/usr/bin/ld: main.cpp:(.text.unlikely+0x1aa): undefined reference to `typeinfo for curlpp::RuntimeError'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `operator<<(std::ostream&, curlpp::OptionTrait<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, (CURLoption)10002> const&) [clone .cold]':
main.cpp:(.text.unlikely+0x1fc): undefined reference to `curlpp::Easy::~Easy()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `main.cold':
main.cpp:(.text.unlikely+0x26a): undefined reference to `curlpp::OptionBase::~OptionBase()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::Option<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::~Option()':
main.cpp:(.text._ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED2Ev[_ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED5Ev]+0x5d): undefined reference to `curlpp::OptionBase::~OptionBase()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `curlpp::Option<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::~Option()':
main.cpp:(.text._ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED0Ev[_ZN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED5Ev]+0x56): undefined reference to `curlpp::OptionBase::~OptionBase()'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `_GLOBAL__sub_I__ZN6curlpp10initializeEl':
main.cpp:(.text.startup+0x39): undefined reference to `curl_global_init'
/usr/bin/ld: main.cpp:(.text.startup+0x47): undefined reference to `curlpp::libcurlRuntimeAssert(char const*, CURLcode)'
/usr/bin/ld: /tmp/ccbdN6Jc.o: in function `main':
main.cpp:(.text.startup+0x222): undefined reference to `curlpp::OptionBase::OptionBase(CURLoption)'
/usr/bin/ld: /tmp/ccbdN6Jc.o:(.data.rel.ro._ZTIN6curlpp11UnsetOptionE[_ZTIN6curlpp11UnsetOptionE]+0x10): undefined reference to `typeinfo for curlpp::RuntimeError'
/usr/bin/ld: /tmp/ccbdN6Jc.o:(.data.rel.ro._ZTIN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE[_ZTIN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE]+0x10): undefined reference to `typeinfo for curlpp::OptionBase'
/usr/bin/ld: /tmp/ccbdN6Jc.o:(.data.rel.ro._ZTVN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE[_ZTVN6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE]+0x20): undefined reference to `curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
/usr/bin/ld: /tmp/ccbdN6Jc.o:(.data.rel.ro._ZTVN6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EEE[_ZTVN6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EEE]+0x20): undefined reference to `curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make: *** [Makefile:7: build] Error 1
This is what I'm trying to do:
using namespace std;
// ...
ostringstream os;
os << curlpp::options::Url(string("url goes here"));
cout << os.str();
And yes, I did replace "url goes here" with my own valid URL.