Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
RTTI symbol not found for class
When debugging my code, I am seeing:
RTTI symbol not found for class 'itk::Region'
in the Application Output. Despite the errors, everything seems to be working fine. Is there a way to suppress these errors?
Sorry, for taking your sentences literal, but there are some significant differences.
- The only way to suppress errors is to fix them.
- If you want to suppress error messages, you shall think twice before ignoring respectively suppressing them.
- Those are warnings (messages), you should think twice before ignoring those.
RTTI is used to determine which method to use during run-time. IMHO I consider those at least as error message even so you might read "warning" somewhere. The RTTI would activate all my alarm bells.
No, no, I agree with you fully. The reason I thought they were just "QtCreator warnings" is that I have worked with this code for years and never seen g++ or gdb complain about anything (even with -Wall). Furthermore, these errors are occurring at run-time, which I have not seen anything like.
So what could I look for to fix the errors?
What is your OS?
Which compiler/tool chain are you using? Is it still gcc?
Did you compile one of the libs yourself?
Most compilers have a possibility of switch RTTI support on and off. So it could be the reason RTTI support has switch ignored.
Linux (Ubuntu 12.04). Yes, g++ 4.6.3.
Yes, I compiled ITK (the library that it seems to be complaining about) by myself. Interesting - which flags should I try to recompile it with?
You need to dig through those. I have found immediately "this here":http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/C_002b_002b-Dialect-Options.html but it refers to RTTI as being switched off. So, it is suggesting that the default it is switched on, but you need to check. Especially for your specific compiler version.
RunTime Type Information is generated by the compiler to describe relations between types at run time. This information is generated by default, but compilers can be asked to skip generating it to save some space. In general that works, but anything that needs this information will then fail. This is most notably dynamic_cast, which will return 0 pointer. Since the code using dynamic casts will usually handle those 0 pointers the code tends to not crash, but it won't deliver the desired results either. I am really happy to hear compilers produce warnings about those issues now... I did spend hours before trying to figure out why some dynamic casts fail for no obvious reason whatsoever:-)
Either turn on RTTI in your library or avoid using dynamic_cast with the types defined in that library. If those types are QObjects you can e.g. use qobject_cast which uses the information from Qts Metatype system instead of RTTI.
Duck last edited by
The error message stems from gdb and also appears from time to time on harmless code. It's most likely a problem in the debug info, either the way gcc creates it, or the way gbd reads it.
Szyk Cech last edited by
Main reason of "RTTI symbol not found for class" are wrong paths in qt.conf in your DESTDIR or in your install dir.
HR_Parisa last edited by HR_Parisa
How can I turn on RTTI ?