title: C++ static library and platform toolset compatibility
body: <p>I recently created a static C++ library in Visual Studio 2008. 
  In this project i used some methods of the <code>std::string</code> class.
  Now i want to use this library in a Visual Studio 2013 project.</p>
  
  <p>The problem is:<br>
  Both Visual Studio versions use different platform toolsets and the project will not compile because of linker errors like:</p>
  
  <blockquote>
    <p>Error 4   error LNK2001: unresolved external symbol
    "__declspec(dllimport) public: __thiscall
    std::basic_string,class
    std::allocator >::basic_string,class std::allocator >(void)"
    (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ)</p>
  </blockquote>
  
  <p>Is there any way to make a library compatible with all platform toolsets and using some standard classes like <code>std::string</code>? </p>
  
  <p>FYI: VS2008 is using v90 platform toolset and VS2013 is using v120 platform toolset.</p>
  
  <p>Thanks.<br><br></p>
  
  <p><strong>Edit:</strong><br><br>
  If i use some standard methods in the library like <code>std::vector</code>, i can't implement the library anymore.</p>
  
  <p>This works:</p>
  
  <pre><code>unsigned int TestClass::TestMethod()
  {   
      return 2;
  }
  </code></pre>
  
  <p>This doesn't:</p>
  
  <pre><code>unsigned int TestClass::TestMethod()
  {
      std::vector&lt;unsigned char&gt; vtest;
      vtest.push_back(0xff);
  
      return 2;
  }
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Error 1   error LNK2019: unresolved external symbol "public: static void
    __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) referenced in function "public: class
    std::basic_string,class
    std::allocator > &amp; __thiscall std::basic_string,class std::allocator >::assign(class
    std::basic_string,class
    std::allocator > const &amp;,unsigned int,unsigned int)"
    (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z)</p>
  </blockquote>
  
  <p>RT lib is set to /MT and whloe program optimization is disabled (/GL).</p>
  
  <p>Is there any way to fix this?</p>
  
  <p>Thanks.</p>