Compile errors occurred. "qmake" swears:
main.o: in function `gdbInterface::gdbInterface(QProcess): undefined reference to `vtable for gdbInterface' main.o: in function `gdbInterface::~gdbInterface()': undefined reference to `vtable for gdbInterface' collect2: error: ld returned 1 exit status I understand that the constructor and the destructor are inherited incorrectly.
Code:
#include <QCoreApplication> #include <QObject> #include <QIODevice> #include <QProcess> #include <QDebug> class gdbInterface : public QObject { Q_OBJECT public slots: void onGDBConnected(); public: gdbInterface(QProcess &gdb); }; void gdbInterface::onGDBConnected(){ } gdbInterface::gdbInterface(QProcess &gdb){ connect(&gdb, &QProcess::started, this , &gdbInterface::onGDBConnected); } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QProcess gdb; QString gdbProgram; QStringList gdbArguments; gdbArguments << "-q" << "/home/byeti/project/meerkat/meerkat_src/rat_lab" ;//<< "--interpreter=mi"; qint64* gdbPid = nullptr; gdbInterface interface(gdb); gdb.setProgram("gdb"); gdb.setArguments(gdbArguments); gdb.startDetached(gdbPid); gdb.close(); getchar(); return a.exec(); }