C ++:什么是“未定义对除虚拟函数之外的对于[类名称]'的类型信息的引用 [英] C++: what are the causes of " undefined reference to 'typeinfo for [class name]' "other than virtual functions

查看:174
本文介绍了C ++:什么是“未定义对除虚拟函数之外的对于[类名称]'的类型信息的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其中一些错误可通过修改

some of these errors are solved by modifying

    virtual void draw();

    virtual void draw() {};

但是,除了虚函数之外,这些错误的其他原因可能是什么?
可能是以下错误的原因。

BUT, what can be the other causes of these errors?, other than virtual functions.. What can be the cause of the following error..

  /tmp/cciGEgp5.o:(.rodata._ZTI14CustomXmppPump[typeinfo for CustomXmppPump]+0x18): 
  undefined reference to `typeinfo for XmppPump'


推荐答案

如果你正在使用RTTI(-frtti)编译,请确保你的依赖库也用它编译,而不是-fno-rtti。否则,当你子类化一个使用-fno-rtti编译的类或使用dynamic_cast时,你会得到typeinfo错误。

If you're compiling with RTTI (-frtti), make sure your dependent libraries are also compiled with it, and not -fno-rtti. Otherwise you will get the typeinfo error when you subclass a class compiled with -fno-rtti or use dynamic_cast.

这篇关于C ++:什么是“未定义对除虚拟函数之外的对于[类名称]'的类型信息的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆