Hello Guys,
I am trying to compile my app to Android, and getting always this error:
error: āto_stringā is not a member of āstdā
My Aapplication.mk has:
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic
Couldnāt fix with all solutions I found in internet,
Any help?
Hi TMSantos
I suggest you to use this super useful function:
cocos2d::StringUtils::format( ... )
It works like āprintfā but instead of printing on stdout return a std::string!
Iām using solution found somewhere in the internet. I created to_string.h (and included it where needed) with following content:
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#include <string>
#include <sstream>
namespace std
{
template<typename T> std::string to_string(const T& t)
{
std::ostringstream os;
os << t;
return os.str();
}
}
#endif
Semiranis solution worked
Drakon99 somehow that method doesnt accept integers as argument.
Thank you guys !
@TMSantos you have to specify the format string to use: StringUtils::format("%d", 5);
See stevetranbyās answer!
1 Like
Yeah, sorry for my stupidity for not looking carefull to the error xD
Both solutions works thank you guys
1 Like