undefined reference to typeinfo - C++ error message
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) like
virtual float getarea() ;
that should read
virtual float getarea() {} 
这个错误解决了
undefined reference to typeinfo - C++ error message的更多相关文章
- undefined reference to `typeinfo for xxx 报错
		
编译成功了,链接的时候出现了这个报错 产生”undefined reference to `typeinfo for xxx’“最常见的原因就是基类的虚函数未实现了. 由于C++类的实现可以分布在多个 ...
 - moc_XXXX.o:(.data.rel.ro._ZTI12CalculatorUI[_ZTI12CalculatorUI]+0x10): undefined reference to `typeinfo for QWidget'  collect2: error: ld returned 1 exit status make: *** [Makefile:144: myCalculator]
		
main.cpp:(.text.startup+0x22): undefined reference to `QApplication::QApplication(int&, char**, ...
 - undefined reference to 'typeinfo for android::Thread'
		
原因:工程使用了系统库libstagefright.so,而该库是Android系统用no-rtti方式编译出来的,因此我们的工程也必须要用no-rtti方式编译. 解决方法:在Application ...
 - C++:undefined reference to vtable 原因与解决办法[转]
		
[转]undefined reference to vtable 原因与解决办法 最近在写一套基础类库用于SG解包blob字段统计,在写完了所有程序编译时遇到一个郁闷无比的错误: MailBox.o( ...
 - (.text+0x12): undefined reference to `rpl_fprintf'
		
问题1:(.text+0x12): undefined reference to `rpl_fprintf'解决办法:在yacc前面添加%{#undef yyerrorvoid yyerror (ch ...
 - ubuntu系统下,gsl 库链接问题 -undefined reference to `cblas_xxx`
		
今天在ubuntu系统下进行程序调试的时候出现以下错误信息: [ %] Linking CXX executable ../test_coco /usr/local/lib/libgsl.so: un ...
 - undefined reference to `dlopen'
		
g++ -O0 -g3 -I. -Ithird/json -Ithird/core/include -Ithird/vite/include -Ithird/openfst-1.2.10/src/in ...
 - boost.numpy编译报错:undefined reference to `PyInt_FromLong' libboost_numpy.so: undefined reference to `PyCObject_AsVoidPtr'
		
[ 31%] Built target boost_numpy[ 36%] Building CXX object libs/numpy/example/CMakeFiles/dtype.dir/dt ...
 - gcc参数-l传递顺序错误导致`undefined reference'的一点小结
		
刚才编译一个pthread的单文件程序, 使用的命令行是: gcc -o thread1 -lpthread thread1.c 结果报错: $ gcc -o thread1 -lpthread th ...
 
随机推荐
- postgresql如何实现group_concat功能
			
MySQL有个聚集函数group_concat, 它可以按group的id,将字段串联起来,如 表:id name---------------1 A2 B1 B SELECT id, group_c ...
 - 【Todo】Lucene系统学习
			
之前已经写过一篇关于Lucene安装学习的文章:http://www.cnblogs.com/charlesblc/p/5980525.html 还有一篇关于Solr安装使用的文章:http://ww ...
 - iOS开发之Xcode6 之手动添加Pch预编译文件
			
参考文档 http://blog.csdn.net/crazyzhang1990/article/details/44243343 红色部分为本人自己补充注意事项 在Xcode6之前,创建一个新工程x ...
 - ACM比赛经验
			
这篇博客是转别人的,觉得很好,希望能在以后的现场赛中用上:ACM比赛经验 推荐此篇文章打印,与模板放在一起. 1. 比赛中评测会有些慢,偶尔还会碰到隔10分钟以上才返回结果的情况,这段时间不能等结果, ...
 - grep的用法
			
grep的用法首先创建我们练习grep命令时需要用到的demo文件demo_file. $ cat demo_file THIS LINE IS THE 1ST UPPER CASE LINE IN ...
 - 闹钟--alarmManager
			
1.AlarmManager,顾名思义,就是“提醒”,是Android中 常用的一种系统级别的提示服务,在特定的时刻为我们广播一个指定的Intent.简单的说就是我们设定一个时间,然后在该时间到来 时 ...
 - 解析excel表格为DataSet
			
using System;using System.Collections.Generic;using System.Data;using System.Data.OleDb;using System ...
 - LinuxShell脚本攻略--第九章 管理重任
			
收集进程信息 $ ps PID TTY TIME CMD pts/ :: bash pts/ :: ps$ ps -f #-f 显示更详细的信息UID PID PPID C STIME TTY TI ...
 - php正则:匹配(),{},[]小括号,大括号,中括号里面的内容
			
php正则:匹配(),{},[]小括号,大括号,中括号里面的内容 比如有一段字符: $s='60c8 {"code":"200","message&q ...
 - 如何在大量jar包中搜索特定字符
			
欢迎关注我的社交账号: 博客园地址: http://www.cnblogs.com/jiangxinnju/p/4781259.html GitHub地址: https://github.com/ji ...