16,813
社区成员




connect(cancel_PushButton,SIGNAL(clicked()),this,SOT(close()));
connect(tk_PushButton,SIGNAL(clicked()),this,SLOT(testPro()));
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
class Dialog : public QDialog
{
Q_OBJECT
public:
Dialog(QWidget *parent = 0);
~Dialog();
};
#endif // DIALOG_H
.cpp文件
#include "Dialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
}
Dialog::~Dialog()
{
}
main.cpp文件
#include "Dialog.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Dialog w;
w.show();
return a.exec();
}
这个是用QtCreator 创建的,我啥都没改,编译通过过,提示error: undefined reference to `vtable for 类名'
如果我把Q_OBJECT宏注释掉,编译通过,可以运行,
我把这三个文件意外的全部文件和目录都删了,编译还是这个样子,我把这三个文件拷贝到别的目录,使用命令行编译
qmake -project
qmake MocTest.pro
mingw32-make
结果还是提示error: undefined reference to `vtable for 类名'