【C++调试】error: 编译报错合集

error: undefined reference to `vtable for 类名'

  • 背景

使用GCC编译代码时遇到以下警告:

CMakeFiles/thriftservice_ut.dir/ncThriftServiceUT.cpp.o: In function `ncClientBuilder::ncClientBuilder(nsCOMPtr<ncITaskStorageClient>, nsCOMPtr<ncITaskMgmClient>, nsCOMPtr<ncIDataMgmClient>, nsCOMPtr<ncIMetaMgmClient>)': 
/home/Nautilus/thriftservice/ncNautilusClientBuilder.h:18: undefined reference to `vtable for ncClientBuilder'
  • 原因

vtable 表示的是虚表,这个错误出现时,请检查你的父类所有虚函数是否实现,或者子类是否把父类的虚函数都处理完。

注意:析构函数也算。

 


 

原文地址:https://www.cnblogs.com/SchrodingerDoggy/p/14314625.html