This happens if actually a "pure virtual" function was called, which results in a crash.
A pure virtual function is one declared:
virtual void pureVirtualFunction() = 0;
Usually the compiler will detect if you omit to implement a pure virtual function. But there can be situations where it can't.
Call of Pure Virtual Function in Base Constructor
One of the common problems are function calls from the base constructor of the class:
MyClass::MyClass() {
pureVirtualFunction(); // Call of pure virtual function from base constructor.
}
Call of Pure Virtual Function in Base Deconstructor
Or a call of a pure virtual method from the deconstructor of a base class:
MyClass::~MyClass() {
pureVirtualFunction(); // Call of pure virtual function from base deconstructor.
}
Forward Declarations of Shared Pointers (and alike)
There is another common case if you use forward declarations like this:
class MyClass;
typedef std::shared_ptr<MyClass> MyClassPtr;
The object of a such shared pointer can be destroyed at many places, but the compiler lacks the required information how to call the deconstructor of the class. Make sure you read all warnings of the compiler, it will warn about this problem (and about many other problems with calls of pure virtual methods.)
For this special case make sure you avoid forward declarations of shared pointers and include them only with the class declaration (if possible).
See also this answer.