RTTI symbol not found for class
-
wrote on 17 Aug 2012, 18:24 last edited by
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?
Thanks,
David
-
wrote on 18 Aug 2012, 08:16 last edited by
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.
-
wrote on 18 Aug 2012, 13:08 last edited by
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?
Thanks,
David
-
wrote on 18 Aug 2012, 13:37 last edited by
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. -
wrote on 18 Aug 2012, 14:02 last edited by
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?
-
wrote on 18 Aug 2012, 14:21 last edited by
"http://lmgtfy.com/?q=gcc+rtti+support":http://lmgtfy.com/?q=gcc+rtti+support
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. -
wrote on 18 Aug 2012, 15:28 last edited by
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.
-
wrote on 18 Aug 2012, 21:16 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.
-
wrote on 11 May 2018, 19:56 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.
-
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.
wrote on 4 Jun 2020, 19:53 last edited by HR_Parisa 6 Apr 2020, 19:56@tobias-hunger
Hi
How can I turn on RTTI ?