typeid() build error in NDK

4,612 views
Skip to first unread message

Chuan Zhou

unread,
Jun 2, 2011, 8:04:27 AM6/2/11
to android-ndk
Hi,

I am using NDK to build some C++ code under Android NDK R5. However I
met the following errors:
error: must #include <typeinfo> before using typeid

However, I already include <typeinfo> in my code. And my GCC has set
to support RTTI by using "-frtti" flag.

Is there any other setting I need to have? Or isn't typeid avaiable on
Android NDK?

Thanks,

alan

unread,
Jun 2, 2011, 10:49:12 AM6/2/11
to andro...@googlegroups.com
rtti is only available when using gnu_stl

Doug Kwan (關振德)

unread,
Jun 2, 2011, 3:39:37 PM6/2/11
to andro...@googlegroups.com
You must include <typeinfo> that defines std::type_info. The
<typeinfo> header in the NDK define type_info outside of any namespace
and it does not provide real RTTI.

-Doug

> --
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
>
>

Chuan Zhou

unread,
Jun 3, 2011, 1:22:53 AM6/3/11
to android-ndk
How can I include the corrent <typeinfo>? Do you know which one I
should include?

Thanks
> > For more options, visit this group athttp://groups.google.com/group/android-ndk?hl=en.- Hide quoted text -
>
> - Show quoted text -

Doug Kwan (關振德)

unread,
Jun 3, 2011, 2:57:44 AM6/3/11
to andro...@googlegroups.com
Use the one in GNU libstdc++

Chuan Zhou

unread,
Jun 7, 2011, 6:23:50 AM6/7/11
to andro...@googlegroups.com
I have tried using the <typeinfo> in GNU libstdc++, however this error still exist. Is there any other possible solution to workaround this?
 
Thanks

2011/6/3 Doug Kwan (關振德) <doug...@google.com>

David Turner

unread,
Jun 7, 2011, 7:00:24 AM6/7/11
to andro...@googlegroups.com
You're not giving a lot of details. Did you add APP_STL := gnustl_static to your Application.mk
What is the exact error message you get? At compile time or link time?

2011/6/7 Chuan Zhou <chuan...@gmail.com>
Reply all
Reply to author
Forward
0 new messages