c++vstaudioeffect

error: cannot allocate an object of abstract type 'mySynth' VST Programming


For a project, I am being asked to create a VST using the Steinberg SDK, i'm using version 2.4.

The issue that I'm having is error:

cannot allocate an object of abstract type 'mySynth'.

When attempting to compile, the error brings me to this section of code:

    AudioEffect* createEffectInstance (audioMasterCallback audioMaster)
    {
            return new mySynth (audioMaster);
    }

I'm a beginner to both c++ and VST programming, I've had no issues compiling the sample AGain and ADelay, as well as the vstxSynth. This is the first attempt of my own, and its really confusing me, from looking at the sample code i cannot seem to find any reason as to why this shouldn't work.

any help would be greatly appreciated. As this is a major learning curve for me, i would appreciate if you could apply with a simplest explanations as possible.

Thankyou :)


Solution

  • Without seeing the class mySynth code it is hard to say but this error is commonly encountered when you have a class containing a pure virtual function. Either that or you have derived from a base class with a pure virtual function and have failed to override it with a derived class implementation.

    If you do not know what that means, look in your class (and sub classes) for functions declared like this

     virtual int my_function() = 0;
    

    This kind of function is a pure virtual function and a class that has one is considered an abstract class and cannot be instantiated. In order to do so you would need to provide an implementation.