Unsolved Deleting sections from a moc file
-
Hi,
I have QDialog called review (review.h, review.cpp and review.ui).
When I run the program I get the following error message:C:\Programming\Projects\build-Folkfriends_1-Desktop_Qt_5_6_1_MinGW_32bit2-Debug\debug\moc_review.cpp:70: error: undefined reference to `Review::on_pushButton_Submit_clicked()'
moc-review.cpp has the following code at line 70:
void Review::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { Review *_t = static_cast<Review *>(_o); Q_UNUSED(_t) switch (_id) { case 0: _t->on_pushButton_Submit_clicked(); break; default: ; } } Q_UNUSED(_a); }
where line 70 is the line starts with case 0.
the pushButton it refers to is non existent any more but this line clearly refers to it. How can I eliminate this reference? If I just simply delete it it causes a SIGSEGV error.
Thank you for your help. -
@gabor53 said:
Review::on_pushButton_Submit_clicked()'
hi
Delete the moc file
Remove the slot from
Review.h
Clean all, rebuild all, maybe run qmake
and it should be gone. -
@mrjj
I did as you told. The original problem is gone. Instead I get a few dozen new error messages. At additem.h I have this code:namespace Ui { class Additem; } class Additem : public QDialog { Q_OBJECT public: explicit Additem(QWidget *parent = 0); ~Additem();
For the class Additem row it gives the following error message:
C:\Programming\Projects\Folkfriends_1\additem.cpp:6: error: invalid use of incomplete type 'class Ui::Additem'
ui(new Ui::Additem)
^
I assume all the other error messages come from the fact that the class definition is somehow incorrect. What is wrong with it? It used to work... -
@gabor53 Looks like moc is not executed for additem. Did you rerun qmake and rebuild? Were ui_additem.h/cpp generated? Did you include ui_additem.h in additem.cpp?
-
@jsulm I checked those files and the ui files were missing from the cpps. After fixing I get a new problem. In moc_mainwindow.cpp there is a line that crashes the program:
const QMetaObject *MainWindow::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; }
According to the debugger the line starting with return crashes the program. What can I do with it? (I ran clean and rebuild and qmake already.) I also noticed that I have Qt 5.7 but it runs with the Desktop Qt 5.6.1 MinGW 32bit. Can this be a problem?
-
@gabor53 Do you call base class constructor in MainWindow constructor?
Can you show MainWindow?
If you build your application with Qt 5.7 then you should execute it with 5.7 -