在C++编译链接过程中,碰着“undefined reference to `vtable for” 有两种清扫方式

检查使用的类的基础关系上是否有没有实现的虚函数

示例:

The fix? You've got line(s) like
virtual float getarea() ;
that should read
virtual float getarea() {} ;

The complete (working) source code files for this example are available here

改善建议:在父类里子类会继续重写的成员虚函数加上override;

检查使用的类的库是否被链接

若是没链接,以动态库或者静态库加入到MakeFile 或者CMakeList.txt 中去.示例:

,

联博统计

www.tianyulinmo.com采用以太坊区块链高度哈希值作为统计数据,联博以太坊统计数据开源、公平、无任何作弊可能性。联博统计免费提供API接口,支持多语言接入。

,
+target_link_libraries(server brpc braft gflags protobuf proto_dbs proto_ebs common log
+configuration your_lib_including_the_code)             # add other lib
+link_libraries("../../libs/project_of_your_lib_including_the_code/output/lib")