Today, I read a blog post about cocos2d and tried to get it. I encountered a problem: Error: No type named 'string' in namespace 'std '; did you mean 'std:: string '? [3]
SpecificCodeAs follows:
Ccuserdefault: shareduserdefault ()-> setstringforkey ("string", "value1"); ccuserdefault: shareduserdefault ()-> setintegerforkey ("integer", 10); ccuserdefault :: shareduserdefault ()-> setfloatforkey ("float", 2.3f); ccuserdefault: shareduserdefault ()-> setdoubleforkey ("double", 2.4); ccuserdefault: shareduserdefault () -> setboolforkey ("bool", true); // print value string ret = ccuserdefault: shareduserdefault ()-> getstringforkey ("string "); cclog ("string is % s", Ret. c_str ());
I thought to myself, why did I still report an error when declaring a string in this box, but their example was okay? First, I did not import the header file, but I found it all. Finally, I understood all kinds of Baidu.
To use the namespace, C ++ is a classic problem. I encountered this problem at school. Mark it. Continue!
using namespace
STD ; // Use namespace (use all)