Tag: QT
During the UI design of QT widgets today, I changed the widget object name. After multiple successful compilation operations, I performed cleanup and re-build, there are a lot of inexplicable errors:
Widget. h: 12: Error: Forward Declaration of 'struct UI: components'
Widget. cpp: 8: Error: Invalid use of incomplete type 'struct UI: components'
Online Search finds that every time you create a new key on the qt design interface, QT automatically generates yyy. ui files, such as widgets. UI, Because I directly created a GUI program and also generated the corresponding class and widget, I changed the UI object name, but the class still uses the class name of widget, therefore, errors may occur.
The solution is to first Delete the ui_widget.h (corresponding to XXX. UI) generated by MOC, and then set the interface object name,
Namespaceui {
Classwidget;
}
Class Name. In this case, modify the name of the widget or dialog or mainwindow In the UI to the widget in the "struct UI: widget" mentioned in the error. In short, keep the class item value in the UI file the same as the objectname of the widget, dialog, or mainwindow In the ui!