Important: Please read the Qt Code of Conduct -

can't find linker symbol for virtual table for `Controller' value

  • Re: Can't find linker symbol for virtual table

    Hi, the linker symbol problem as mentioned in the topic above still seems to be present?

    I made a small code example with which I keep on having the notification "can't find linker symbol for virtual table for 'Controller' value" in QtCreator while running the application in debug mode and having a breakpoint on "Controller controller;". Even after doing a fresh clean, qmake and build.

    • Platform: Windows 10
    • IDE: QtCreator version 4.11.1 (Built on Feb 5 2020).
    • Kit: Desktop Qt 5.12.6 MinGW 32-bit
    #include "Controller.h"
    #include <QApplication>
    int main(int argc, char *argv[])
        QApplication a(argc, argv);
        Controller controller;                   // Put breakpoint here
        return a.exec();
    // Controller.h
    #ifndef CONTROLLER_H
    #define CONTROLLER_H
    #include "MainWindow.h"
    #include <QObject>
    class Controller : public QObject
        Controller(QObject *parent = nullptr);
        MainWindow *m_mainWindow;
    #endif // CONTROLLER_H
    // Controller.cpp
    #include "Controller.h"
    Controller::Controller(QObject* parent)
        : QObject(parent)
        //, m_mainWindow(new MainWindow())  // Virtual table notification occurs no matter if this line is commented or not
    // MainWindow.h
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    #include <QMainWindow>
    class MainWindow : public QMainWindow
        MainWindow(QWidget *parent = nullptr);
    #endif // MAINWINDOW_H
    // MainWindow.cpp
    #include "MainWindow.h"
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)

    So, I got these virtual table notifications in debug mode in a larger program. I then created a completely new Qt Widgets Application and just added the Controller class in between. Initializing the m_mainWindow pointer or not and cleaning it up in the example does not change anything for the notification. Am I missing anything here or is there some problem with QtCreator or so?

    With kind regards

  • Pro file

    QT       += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    CONFIG += c++11
    SOURCES += \
        main.cpp \
        Controller.cpp \
    HEADERS += \
        Controller.h \

  • The notification is not shown in the following cases:

    • when building the same code with MinGW 64-bit (instead of the 32-bit)
    • when adding controller.setObjectName("Controller");
    • using Controller *controller = new Controller(); and deleting it at the end

  • Qt Champions 2017

    @maxp said in can't find linker symbol for virtual table for &#x60;Controller' value:

    when building the same code with MinGW 64-bit (instead of the 32-bit)

    Then probably doesn't mean anything. Does your code run correctly otherwise?

  • Thanks for answering. Yes, I haven't spot any problems yet with running apart from that notification.
    But since I get it here on several Windows computers, I wanted to be sure.

  • Qt Champions 2017

    Well, my best advice is keep an eye on it, if it causes trouble in the future then revisit the issue. I couldn't spot anything obvious in the code itself, and it disappearing with a different version of the same compiler probably means it's some peculiarity of the linkage that's probably irrelevant.

Log in to reply