undefined reference to typeinfo - C++ error message
来源:互联网 发布:淘宝双十一不能报名 编辑:程序博客网 时间:2024/05/15 12:12
There are some compiler and loader error messages that shout obviously as to their cause, but there are others that simply don't give the new user much of an indication as to what's really wrong. And most of those I get to know pretty quickly, so that I can whip around a room during a course, making suggestions to delegate to check for missing ; characters or double quotes, to check that they have used the right type of brackets for a list subscript and haven't unintentionally written a function call, etc.
Here's one of the more obscure messages from the Gnu C++ compiler - or rather from the loader:g++ -o polygon shape.o circle.o square.o polygon.o
circle.o(.gnu.linkonce.r._ZTI6Circle+0x8): undefined reference to `typeinfo for Shape'
square.o(.gnu.linkonce.r._ZTI6Square+0x8): undefined reference to `typeinfo for Shape'
polygon.o(.gnu.linkonce.t._ZN5ShapeC2Ev+0x8): In function `Shape::Shape()':
: undefined reference to `vtable for Shape'
collect2: ld returned 1 exit status
And you can be scratching you head for hour over that one!
The error? shape.o contains a base class from which classes are derived in circle.o and square.o .. but virtual function(s) in shape's definition are missing null bodies.
The fix? You've got line(s) likevirtual float getarea() ;
that should readvirtual float getarea() {} ;
这个错误解决了
- undefined reference to typeinfo - C++ error message
- error: undefined reference to 'typeinfo for FileDialogDelegate'
- Undefined Reference to Typeinfo
- Undefined Reference to Typeinfo
- Undefined Reference to Typeinfo
- error: undefined reference to 'typeinfo for android::MediaSource' 错误解决
- undefined reference to `typeinfo for QWidget'的解决
- C++ 编译出现undefined reference to `vtable for Class 和 undefined reference to typeinfo for Class
- error: undefined reference to `pthread_create'
- undefined reference to error解决方法
- undefined reference to error解决方法
- undefined reference to error解决方法
- undefined reference to error解决方法
- error:undefined reference to `coloured_LED_init'
- undefined reference to error解决方法
- Error: undefined reference to png_check_sig
- undefined reference to error解决方法
- Error:undefined reference to '_imp__ZN12QApplicationC1ERiPPci'
- 快钱支付平台 退款功能
- Windows GDI和GDI+编程实例剖析 (2)
- 带解释的VBA短句
- comboBox 的DropDownStyle 要设置为“dropdownList”
- 项目百态(第19届Jolt奖获奖作品,入木三分刻画软件项目众生图)
- undefined reference to typeinfo - C++ error message
- 兄弟连原创视频光盘火热销售
- Android 文件下载
- Linux 时间日期函数
- 励志
- linux Eclipse 使用数学库 配置方法
- js跨域请求数据实现
- uImage与zImage的区别
- SAP中的Currency Converting Factor