Qt “signal undefined reference error” after inheriting from QObject

后端 未结 1 1595
执念已碎
执念已碎 2021-02-14 19:14

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 19:59

    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)
提交回复
热议问题