title: Error LNK2005 when trying to link against Boost 1.53
body: <p>I am currently trying to link against the boost lib</p>
  
  <pre><code>libboost_regex-vc90-mt-gd-1_53.lib
  </code></pre>
  
  <p>which is created out of this command line</p>
  
  <pre><code>b2^
   --stagedir=%BOOST_OUTPUT_DIR%^
   --build-dir=%BOOST_BUILD_DIR%^
   toolset=msvc-9.0^
   link=static^
   variant=release,debug^
   threading=multi^
   runtime-link=shared^
   stage
  </code></pre>
  
  <p>but i get the following linkage error (one among many other) :</p>
  
  <pre><code>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;::~basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) déjà défini(e) dans TrailerContest.Reflection.obj
  </code></pre>
  
  <p>I have increased the linker verbosity to know more about this error and here is what I get :</p>
  
  <pre><code>Searching c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\msvcprtd.lib :
  1&gt;      "__declspec(dllimport) public: __thiscall std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;::~basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;(void)" (__imp_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) found
  1&gt;        Referenced in libboost_date_time-vc90-mt-gd-1_53.lib(greg_month.obj)
  1&gt;        Referenced in libboost_random-vc90-mt-gd-1_53.lib(random_device.obj)
  1&gt;        Referenced in libboost_thread-vc90-mt-gd-1_53.lib(thread.obj)
  1&gt;        Referenced in libboost_regex-vc90-mt-gd-1_53.lib(instances.obj)
  1&gt;        Referenced in libboost_regex-vc90-mt-gd-1_53.lib(regex.obj)
  1&gt;        Referenced in libboost_regex-vc90-mt-gd-1_53.lib(w32_regex_traits.obj)
  1&gt;        Referenced in libboost_system-vc90-mt-gd-1_53.lib(error_code.obj)
  1&gt;        Loaded msvcprtd.lib(MSVCP90D.dll)
  1&gt;msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;::~basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in TrailerContest.Reflection.obj
  </code></pre>
  
  <p>it seems that all boost libs try to import std::string functions from MSVCP90D.dll</p>
  
  <pre><code>__imp_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ
  </code></pre>
  
  <p>while my own program seems to embed the std::string code and therefore tries to link internally.</p>
  
  <pre><code>      ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ
  </code></pre>
  
  <p>I think I have two choices here, either I make boost embed std::string code so boost and my program have the same declaration in both objs and linkage can be achieved.
  Either my program must import std::string code from MSVCP90D.dll the same way boost does.</p>
  
  <p>The problem is I don't know how to ask boost to compile without importing std::string code.
  And I don't know how to force my program to import std::string from MSVCP90D.dll, anyone has an idea ?</p>
  
  <p>I must say that my program is obviously compiled with /MDd option. Boost should also be compiled with this option with the line <strong>runtime-link=shared</strong></p>