c++ - Implicit instantiation of undefined template 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >' -


in project have been working on, have send cocoa notifications c++ sub-projects main project above it. construct map act key-value store userinfo dictionary of notification.

in 1 of projects, following code compiles fine:

std::map<std::string, std::string> *userinfo = new std::map<std::string, std::string>; char buffer[255];  sprintf(buffer, "%i", intvalue1); userinfo->insert(std::pair<std::string, std::string>("intvalue1", std::string(buffer)));  sprintf(buffer, "%i", intvalue2); userinfo->insert(std::pair<std::string, std::string>("intvalue2", std::string(buffer)));  if(condition)     userinfo->insert(std::pair<std::string, std::string>("conditionalvalue", "true"));  postcocoanotification("notificationname", *userinfo); 

however, when copied identical file in sub-project, compiler throws following on userinfo->insert calls:

"implicit instantiation of undefined template 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >'"  

..and cannot find function postcocoanotification:

no matching function call 'postcocoanotification' 

additionally, throws following errors in system headers:

/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<char, std::char_traits<char>, std::allocator<char> >' /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<char, std::char_traits<char>, std::allocator<char> >' /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<char, std::char_traits<char>, std::allocator<char> >' /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 parameter of type '_link_type' (aka '_rb_tree_node<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > *') rvalue of type '_const_link_type' (aka 'const _rb_tree_node<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > *') 

i've no idea i've done cause such chaos, when code runs fine in sub-project (successfully sending notifications). insight problem welcome.

you need include these headers:

#include <string> #include <sstream> #include <iostream> 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -