一、问题
在正常开发过程中,突然遇到了这个报错:
:-1: error: debug/moc_mainwindow.o: in function
`MainWindow::qt_static_metacall(QObject*, QMetaObject::Call,
int, void**)':
undefined reference to `MainWindow::on_pushButton_clicked()'
:-1: error: collect2.exe: error: ld returned 1 exit status
:-1: error: [Makefile.Debug:113: debug/daoyintou.exe] Error 1
二、原因
根据提示的位置,是创建了一个slots,但是没有对这个函数进行一个声明,所以只需要在MainWindow.h中找到这个slots,然后对这个函数进行声明即可解决错误。