9

I´m getting this "Cannot use typeid with -fno-rtti" when I´m trying to compile my project, I´m using an opencv framework. I googled the problem but, it seems the errors I found in internet does not have relation with my problem. I don´t know if the problem is related with the includes, the code or the compiler.

Xcode is giving me the error a lot of times, but the first error is here:

virtual const std::type_info& type() { return typeid(T); }
1
  • 2
    for Android NDK: cppFlags += "-frtti" Aug 25, 2015 at 3:50

2 Answers 2

9

It's telling you the error right in the message: if you use the no-rtti flag on the compiler, then typeid is not going to be available. Just enable RTTI; it's part of C++ after all.

0
3

RTTI stands for Run Time Type Information, and typeid is an RTTI-feature. So turning off RTTI (-fno-rtti) also disables features like typeid.

See http://en.wikipedia.org/wiki/RTTI for more information about RTTI in C++.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.