title: Implicit instantiation of undefined template 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >'
body: <p>In the project I have been working on, we have to send Cocoa notifications from C++ sub-projects to the main project above it. To do this we construct a map to act as a key-value store for the userInfo dictionary of the notification.</p>
  
  <p>In one of the projects, the following code compiles just fine:</p>
  
  <pre><code>std::map&lt;std::string, std::string&gt; *userInfo = new std::map&lt;std::string, std::string&gt;;
  char buffer[255];
  
  sprintf(buffer, "%i", intValue1);
  userInfo-&gt;insert(std::pair&lt;std::string, std::string&gt;("intValue1", std::string(buffer)));
  
  sprintf(buffer, "%i", intValue2);
  userInfo-&gt;insert(std::pair&lt;std::string, std::string&gt;("intValue2", std::string(buffer)));
  
  if(condition)
      userInfo-&gt;insert(std::pair&lt;std::string, std::string&gt;("conditionalValue", "true"));
  
  PostCocoaNotification("notificationName", *userInfo);
  </code></pre>
  
  <p>However, when this is copied into an identical file in another sub-project, the compiler throws the following on the userInfo->insert calls:</p>
  
  <pre><code>"Implicit instantiation of undefined template 'std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;'" 
  </code></pre>
  
  <p>..and it cannot find the function for PostCocoaNotification:</p>
  
  <pre><code>No matching function for call to 'PostCocoaNotification'
  </code></pre>
  
  <p>Additionally, it throws the following errors in system headers: </p>
  
  <pre><code>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/c++/4.2.1/bits/stl_pair.h:73:11: Implicit instantiation of undefined template 'std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;'
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/c++/4.2.1/bits/stl_pair.h:74:11: Implicit instantiation of undefined template 'std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;'
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/c++/4.2.1/bits/stl_pair.h:73:11: Implicit instantiation of undefined template 'std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;'
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/c++/4.2.1/bits/stl_tree.h:1324:13: Cannot initialize a parameter of type '_Link_type' (aka '_Rb_tree_node&lt;std::pair&lt;const std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; *') with an rvalue of type '_Const_Link_type' (aka 'const _Rb_tree_node&lt;std::pair&lt;const std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; *')
  </code></pre>
  
  <p>I've no idea what I've done to cause such chaos, especially when the code runs perfectly fine in another sub-project (successfully sending notifications). Any insight to the problem would be very welcome.</p>