Qt “signal undefined reference error” after inheriting from QObject

后端 未结 1 1060
故里飘歌
故里飘歌 2021-02-14 19:20

I recently needed to add a signal to a class, so I changed the class to inherit from QObject and added the Q_OBJECT macro into the class definition. Since doing so I get

1条回答
  •  臣服心动
    2021-02-14 20:08

    You need to make sure 'moc' is (re)run for those changes. It seems that you either miss the generated moc file, or that is outdated and hence not containing the proper reference to the current state.

    QtCreator does not rerun qmake properly when the Q_OBJECT macro is added. This has been a long standing issue, so you will need to rerun it manually.

    https://bugreports.qt.io/browse/QTCREATORBUG-231

    0 讨论(0)
提交回复
热议问题