title: Link errors with curlpp
body: <p>I wrote a c++ program and try to use curlpp to access a http server securely over <code>SSL</code>. The problem is, that I can't link the program.</p>
  
  <p>Operating system: <strong>Ubuntu 15.10</strong></p>
  
  <p>Errors:</p>
  
  <blockquote>
    <p>/usr/bin/cmake -E cmake_link_script
    CMakeFiles/prtg_probe.dir/link.txt --verbose=1
        Wird gelinkt prtg_probe (c++)
        CMakeFiles/prtg_probe.dir/probe.cpp.o: In function curlpp::internal::OptionContainer, std::allocator >,
    std::allocator, std::allocator > > ></p>
    
    <blockquote>
      <p>::OptionContainer(std::__cxx11::list, std::allocator >,
      std::allocator, std::allocator > > > const&amp;)':
          /usr/include/curlpp/internal/OptionContainer.inl:38: undefined reference to
      curlpp::internal::SList::SList(std::__cxx11::list, std::allocator >,
      std::allocator, std::allocator > > > const&amp;)'
          CMakeFiles/prtg_probe.dir/probe.cpp.o: In function curlpp::internal::OptionContainer, std::allocator >,
      std::allocator, std::allocator > > >
      ::setValue(std::__cxx11::list, std::allocator >,
      std::allocator, std::allocator > > > const&amp;)':
          /usr/include/curlpp/internal/OptionContainer.inl:52: undefined reference to
      `curlpp::internal::SList::operator=(std::__cxx11::list, std::allocator >,
      std::allocator, std::allocator > > > const&amp;)'
          ....</p>
    </blockquote>
  </blockquote>
  
  <p>This is the code that produces the errors:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  #include &lt;string&gt;
  #include &lt;cstring&gt;
  #include &lt;cctype&gt;
  #include &lt;cstddef&gt;
  #include &lt;cstdio&gt;
  #include &lt;cstdlib&gt;
  #include &lt;fstream&gt;
  #include &lt;cerrno&gt;
  #include &lt;boost/bind.hpp&gt;
  #include &lt;curlpp/cURLpp.hpp&gt;
  #include &lt;curlpp/Easy.hpp&gt;
  #include &lt;curlpp/Options.hpp&gt;
  #include &lt;curlpp/Exception.hpp&gt;
  
  ....
  
  class myclass
  {
  
  ....
  
  try
  {
      curlpp::Cleanup cleaner;
      curlpp::Easy request;
      ostringstream os;
  
      request.setOpt(new curlpp::options::Url(&amp;url_announce[0]));
      request.setOpt(new curlpp::options::SslEngineDefault());
      list&lt;string&gt; header;
      header.push_back("Content-Type: text/*");
      request.setOpt(new curlpp::options::HttpHeader(header));
      request.setOpt(new curlpp::options::PostFields(data_announce));
      request.setOpt(new curlpp::options::PostFieldSize((long)data_announce.length()));
      request.setOpt(new curlpp::options::WriteStream(&amp;os));
      request.perform();
      request_announce = os.str();
  }
  catch (curlpp::LogicError &amp; e)
  {
      syslog(LOG_DAEMON, "Error accessing PRTG server: %s", e.what());
  }
  catch (curlpp::RuntimeError &amp; e)
  {
      syslog(LOG_DAEMON, "Error accessing PRTG server: %s", e.what());
  }
  </code></pre>
  
  <p>Every line with <code>curlpp::options::...</code> produces one error at link time. I've looked around and searched Google for hours now, but all I found was to link libcurl together with libcurl. I do that, but still get this errors.</p>
  
  <p>Here is the complete link line:</p>
  
  <pre><code>/usr/bin/c++   -g    CMakeFiles/prtg_probe.dir/sensors.cpp.o 
  CMakeFiles/prtg_probe.dir/mini_probe.cpp.o CMakeFiles/prtg_probe.dir/probe.cpp.o
  CMakeFiles/prtg_probe.dir/helper.cpp.o 
  CMakeFiles/prtg_probe.dir/config.cpp.o CMakeFiles/prtg_probe.dir/main.cpp.o
  -o prtg_probe -rdynamic -lm -lpthread -lcrypto -lssl -lcurlpp -lcurl -lboost_system -lboost_filesystem -ljsoncpp -luuid
  </code></pre>
  
  <p>Does anybody know what I'm missing? Do I have to add one more library and if yes which one?</p>
  
  <hr>
  
  <p>I've tried to compile the <a href="https://github.com/jpbarrette/curlpp/blob/master/examples/example00.cpp" rel="noreferrer">example00.cpp</a> with the following command:</p>
  
  <pre><code>g++ -o example00 example00.cpp -lm -lcurl -lcurlpp
  </code></pre>
  
  <p>and the result:</p>
  
  <pre><code>/tmp/cc3pcvDc.o: In Funktion `curlpp::OptionTrait&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, (CURLoption)10002&gt;::updateHandleToMe(curlpp::internal::CurlHandle*) const':
  example00.cpp: (.text._ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE[_ZNK6curlpp11OptionTraitINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE]+0x68):
  Nicht definierter Verweis auf `curlpp::UnsetOption::UnsetOption(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)'
  /tmp/cc3pcvDc.o: In Funktion `curlpp::Option&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::getValue() const':
  example00.cpp: (.text._ZNK6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE8getValueEv[_ZNK6curlpp6OptionINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE8getValueEv]+0x68):
  Nicht definierter Verweis auf `curlpp::UnsetOption::UnsetOption(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>This looks like the same problem to me.</p>