title: MongoDB C++ Driver - Unresolved External Symbol
body: <p>I'm trying to run the example program for the MongoDB C++ Driver so I can run some tests, and have come across some errors that I'm stuck on.</p>
  
  <pre><code>Error   1   error LNK2019: unresolved external symbol "__declspec(dllimport)     public: __thiscall mongo::DBClientConnection::DBClientConnection(bool,class     mongo::DBClientReplicaSet *,double)" (__imp_??0DBClientConnection@mongo@@QAE@_NPAVDBClientReplicaSet@1@N@Z) referenced in function "void __cdecl run(void)" (?run@@YAXXZ)  E:\Programming\C++\BoostTest\BoostTest\BoostTest\Testcpp.obj    BoostTest
  
  Error   2   error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall mongo::DBClientConnection::~DBClientConnection(void)" (__imp_??1DBClientConnection@mongo@@UAE@XZ) referenced in function "void __cdecl run(void)" (?run@@YAXXZ) E:\Programming\C++\BoostTest\BoostTest\BoostTest\Testcpp.obj    BoostTest
  
  Error   3   error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall mongo::DBClientConnection::connect(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;)" (__imp_?connect@DBClientConnection@mongo@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "void __cdecl run(void)" (?run@@YAXXZ)   E:\Programming\C++\BoostTest\BoostTest\BoostTest\Testcpp.obj    BoostTest
  </code></pre>
  
  <p>Here's the code</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include "mongo\client\dbclient.h"
  
  #define BOOST_ALL_DYN_LINK
  
  void run()
  {
      mongo::DBClientConnection c;
      c.connect("localhost");
  }
  
  int main()
  {
      try
      {
          run();
          std::cout &lt;&lt; "Connected" &lt;&lt; std::endl;
      }
      catch(const mongo::DBException &amp;e)
      {
          std::cout &lt;&lt; "caught " &lt;&lt; e.what() &lt;&lt; std::endl;
      }
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>Before anyone asks, I have the Boost Libraries and Headers referenced and they seem to work fine. I have also referenced the Mongo libraries and Headers.</p>
  
  <pre><code>Additional Include Directories: Boost and Mongo Source
  
  Linker Additional Library Directories: boost/stage/lib and Mongo build client
  </code></pre>
  
  <p>Anyone have any clues? Do I have to include the dbclient.obj file in Additional Dependencies? When I do I get like 96 new errors. I think I might be missing some .dll but can't figure out what.</p>
  
  <p>Would appreciate any help as this is only a small part of a much larger project.</p>