Hello,
I use in my code :
int fichier = 1 ;
std::string nomDuFichier = std::to_string(fichier);
And i have compilation error when i compile for android : "error ‘to_string’ is not a member of std."
Do you know why ?
In advance thanks,
Hello,
I use in my code :
int fichier = 1 ;
std::string nomDuFichier = std::to_string(fichier);
And i have compilation error when i compile for android : "error ‘to_string’ is not a member of std."
Do you know why ?
In advance thanks,
Maybe this could help:
to_string() not working for Android
I’m usually using sprintf()
, but that might not be the most convenient way…
In your Application.mk
put APP_STL := c++_static
Ok thanks, this solution make the application crash “in your Application.mk put APP_STL := c++_static”, so i do that :
cocos2d::__String * nomDuFichier = String::createWithFormat("%d.png", fichier);
signe->setTexture(nomDuFichier->_string);
Thanks for your answer,
I’m sorry I forgot to mention you have to remove gnustl and replace it with c++_static.
Anyway you found another way so it’s cool
Ok, no problem, thanks again for your answer
you can also do something like this -
std::stringstream ss;
ss << "I have " << 1000 << " dollars with me";
CCLOG(ss.str().c_str());
This will print a string.
"I have 1000 dollars with me"
you can also use the numbers only to convert to string.
Hope this helps.
Happy Coding
Ok, very nice, thanks
Hey, do you know why isn’t this the default configuration? I’ve tried it and it seems to work on my devices at least.
I believe it is the default configuration now.
Hello, I use:
“StringUtils::format(”%d", myInt);"