Important: Please read the Qt Code of Conduct -

Inheritance classes draw errors: cannot allocate objects of abstract type

  • I am attempting to create a wrapper for the many Jack Audio library functions that will be binary compatible. The structure is using the base / abstract class model with d_ptr references.

    The base class : jackport.h
    class JackPortPrivate;
    class JackPort

    JackPort(const QString &name, JackPortFlags type);
    virtual ~JackPort();

    virtual void setData(void *data, quint32 nFrames) = 0;
    // this function is called by the jack thread
    // Implement it to implement your own port
    // param: data the buffer that jack provide. It is valid until the function returns
    // param: nFrames the number of frames in data
    JackPortPrivate *const d_ptr;
    JackPort(JackPortPrivate &dd);

    friend class QJackClient;
    friend class QJackClientPrivate;

    The derived class is:
    #include "jackport.h"

    namespace QJack
    class JackInPort : public JackPort
    // Inherit from this class if you want to create your own inport

    JackInPort(QString &name);
    } // namespace

    used as : in_port = new QJack::JackInPort("inport", client->nFrames() * 2, client); (supplied code is not complete)

    Some of the background for this is in the KDE-technical article on Binary Compatibility Future Strategies found here: and here:

    What am I missing?

  • <code>JackInPort</code> does not implement <code>void setData(void *data, quint32 nFrames)</code> and therefore is an abstract type due to the base <code>JackPort</code> beeing an abstract type as well.

  • Thank you Lukas ... I have been able to proceed with it now.

Log in to reply