title: cpprest linker error: undefined reference to 'web::http::client::http_client::~http_client()'
body: <p>I followed the build instruction here: <a href="https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Linux" rel="nofollow noreferrer">https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Linux</a></p>
  
  <pre><code>#include &lt;cpprest/http_client.h&gt;
  #include &lt;cpprest/filestream.h&gt;
  
  using namespace utility;                    // Common utilities like string conversions
  using namespace web;                        // Common features like URIs.
  using namespace web::http;                  // Common HTTP functionality
  using namespace web::http::client;          // HTTP client features
  using namespace concurrency::streams;       // Asynchronous streams
  
  int main(int argc, char* argv[])
  {
      auto fileStream = std::make_shared&lt;ostream&gt;();
  
      // Open stream to output file.
      pplx::task&lt;void&gt; requestTask = fstream::open_ostream(U("results.html")).then([=](ostream outFile)
      {
          *fileStream = outFile;
  
          // Create http_client to send the request.
          http_client client(U("http://www.bing.com/"));
  
          // Build request URI and start the request.
          uri_builder builder(U("/search"));
          builder.append_query(U("q"), U("cpprestsdk github"));
          return client.request(methods::GET, builder.to_string());
      })
  
      // Handle response headers arriving.
      .then([=](http_response response)
      {
          printf("Received response status code:%u\n", response.status_code());
  
          // Write response body into the file.
          return response.body().read_to_end(fileStream-&gt;streambuf());
      })
  
      // Close the file stream.
      .then([=](size_t)
      {
          return fileStream-&gt;close();
      });
  
      // Wait for all the outstanding I/O to complete and handle any exceptions
      try
      {
          requestTask.wait();
      }
      catch (const std::exception &amp;e)
      {
          printf("Error exception:%s\n", e.what());
      }
  
      return 0;
  }
  </code></pre>
  
  <p>I compile with <code>g++ -std=c++11 castutorial.cpp -o castutorial -lboost_system -lcrypto -lssl -lcpprest</code></p>
  
  <p>Here is the compiler error message:</p>
  
  <pre><code>/tmp/cck5DpD0.o: In function `main::{lambda(Concurrency::streams::basic_ostream&lt;unsigned char&gt;)#1}::operator()(Concurrency::streams::basic_ostream&lt;unsigned char&gt;) const':
  castutorial.cpp:(.text+0x3c8): undefined reference to `web::http::client::http_client::~http_client()'
  castutorial.cpp:(.text+0x48a): undefined reference to `web::http::client::http_client::~http_client()'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>How do I find the implementation for http_client.h?  I read about linker errors.  From my understanding, an object file or a lib file is supposed to exist somewhere to be compiled with this my program.</p>