error when use rtti

error when use rtti
0.0 0


I use my old android project on new version of cocos2d-x : 0.11v.
But when i use “rtti” with “APP_CPPFLAGS += -frtti” in,it have new error:
“undefined reference to std::ios_base”
Full log when i build native code is:
([typeinfo for std::basic_ios<char, std::char_traits >]+0x8):
undefined reference to ‘typeinfo for std::ios_base’
on old version 0.10,don’t have this error.
So what i can do to fix this?
Thanks anyone to read.
Sorry for my bad english.


Please add it in


sorry,but I don’t understand what is “it” here.
It’s your

APP_MODULES := cocos2d box2d cocosdenshion game_logic game

  • when I use Cygwin to build,it have error I told.
    In my C*+ code,I use some code which std::string and std::stringstream
    May be that cause error?

on cocos2dx-v0.10, you don’t use RTTI, the of it is:
APP_MODULES := cocos2d box2d cocosdenshion game_logic game
So I can build my game without that error

  • thanks for your help. What I can do with to fix this error


On cocos2dx-v0.11, the of HelloWorld is

APP_STL := gnustl_static
APP_CPPFLAGS += -frtti

APP_MODULES := cocos2d cocosdenshion game_logic helloworld

I change APP_STL := gnustl_static to APP_STL := stlport_static, it works correctly too.
My ndk version is r6b.


I use create-android-project.bat to creat a new helloworld project for test, with the is:
APP_STL := stlport_static APP_CPPFLAGS += -frtti APP_MODULES := cocos2d cocosdenshion game_logic game
It run correctly.
Now,in helloworld.cpp,I include and I replace line 52:
“CCLabelTTF* pLabel = CCLabelTTF::labelWithString(”Hello World“,”Arial“, 24);”
with some simple code:

std::stringstream stream; int a = 12345; stream << a; std::string num = stream.str(); // create and initialize a label CCLabelTTF* pLabel = CCLabelTTF::labelWithString(num.c_str(), "Arial", 24);

When I build again,it have error:
../android/obj/local/armeabi/objs-debug/game_logic/HelloWorldScene.o: ([typeinfo for std::basic_ios<char, std::char_traits<char> >]+0x8): undefined reference to `typeinfo for std::ios_base'

I sure this error have because I use std::stringstream.
With win32 project in visual studio 2010,It run without error.
On cocos2dx-v.10,which you don’t add -frtti to to use RTTI, I can use std::stringstrem without error,too.
I use NDK r6b,too.


I need to use std::stringstream to convert fload to string,and it cause error
Do you have different methor to do it? Class CCString only convert int,not float
Thanks for giving your time


I think you can you use spritef().


can you give me an example? I try to find but see nothing in Cocos2dx


I am sorry, it is sprintf.


I’ve got the same problem around std::stringstream. You know, when I tried to use simple std::string all was good. I beleive it is connected with std::stringstream only. Do you know how to solve the problem ?
Thanks in advance.


Try to use gnustl_static.


With gnustl_static the number of errors is much more. :frowning:
May be I can handle without std::stringstream, but the problem exists and have to be solved. :slight_smile:
Thank you.