Undefined reference to vtable

I have to make a Chain of Mountains that contains other chains or simple mountains. For that reason I constructed a Class Mountain and then two sub-class. The subclass Chain and the subclass MountainSingle. The class chain contains itself a vector of pointers to other objects of type Mountain(Thus I have a vector containing pointers to other MountainSingle or Chain). My code is the following:


Chain* Chain::copie() const {
return (new Chain(*this));

Chain::Chain(Chain const & other){
for(auto element: other.ChainofChain){

void Chain::dessine_sur(SupportADessin & support) const {
for(auto element: ChainofChain){
element->dessine_sur(support);// erwtisi avrio na teleiwnoume

std::vector<Mountain *> Chain::get_Chains() const
return ChainofChain;

double Chain::altitude(double x, double y) const {
double alt = 0;

for(auto element : ChainofChain)
if(element->altitude(x,y) > alt){ alt = element->altitude(x,y); }
return alt;


#include "Dessinable.h"
#include "SupportADessin.h"

class Mountain:public Dessinable{
virtual void dessine_sur(SupportADessin & support) const override= 0;
virtual Mountain* copie() const = 0;
virtual double altitude(double x, double y)const =0;
virtual ~Mountain(){}

But upon compilation I get the following error. I know that there are many other posts about the issue but even if I made the small adjustements proposed I still get the following error

Chain::Chain(Chain const & ): undefined reference to vtable for chain.

Thank you in advance
My code is the following:

Part of your code is....

Without the rest of the classes, this can't be compiled.....
Typically the error means that you have declared but not defined the first virtual member function in class Chain.

For example this program exhibits the problem
struct a { virtual void f(); };
int main() {}

But this one does not:
struct a { virtual void f() {}; virtual void g(); };
int main() {}

Last edited on
Topic archived. No new replies allowed.