Important: Please read the Qt Code of Conduct -

removing qaction from action editor still leave it in moc file

  • Hi All,
    I removed an action from my main window action editor. I removed the associated cpp ui and h files. However when I compile my moc_mainwindow.cpp report an error for the removed action.

    "moc_mainwindow.cpp:178: error: undefined reference to `MainWindow::on_actionOptions_2_triggered()'"

    That is linked to code

    void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
        if (_c == QMetaObject::InvokeMetaMethod) {
            MainWindow *_t = static_cast<MainWindow *>(_o);
            switch (_id) {
            case 10: _t->on_actionOptions_2_triggered(); break;

    However I deleted the action from the action editor and also removed any cpp/h/ui associated with it.
    Can/Should I just delete the moc file line? Or is there a better way?

  • just rebuild the project (delete the moc file and run moc again)

  • Lifetime Qt Champion


    Did you remove the declaration of on_actionOptions_2_triggered ?

Log in to reply