This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linker error: undefined reference to typeinfo for A with no-rtti option


Ian Lance Taylor <iant@google.com> writes:
> Read about the key method and type_info objects here:
>
> http://gcc.gnu.org/onlinedocs/gcc/Vague-Linkage.html
>
> I won't go into all the details, but basically if you mix -frtti and
> -fno-rtti code you need to ensure that any classes created in the
> -frtti code have their key method compiled with -frtti.

Thank you for your report.

As I understand B key method is auto generated ~B() and compiler
creates it in main compilation unit with type_info object. Even this
object never been used compiler creates it anyway. Right?
So type_info for B needs type_info for A and ask linker to find it.
Linker can't find it, because A key method and vtable was created with
-fno-rtti.

And the last question: does the type_info object for B really need in
main.cpp or compiler creates it just in case?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]