开发者

How to solve those Qt errors?

I have the following files part of a Qt program:

checkabder.h

#include <QDialog>
#include "ui_checkabder.h"
class CheckAbder: public QDialog, public Ui::CheckAbder
{
Q_OBJECT
public:
CheckAbder(QWidget *parent=0);
private slots:
void on_lineEdit_textChanged();
};

checkabder.cpp

#include <QtGui>
#include "checkabder.h"
CheckAbder::CheckAbder(QWidget *parent): QDialog(parent)
{
setupUi(this);
QRegExp regexp("Abder-Rahman");
QValidator *validator = new QRegExpValidator(regexp, this);
lineEdit->setValidator(validator);
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}

void CheckAbder::on_lineEdit_textChanged()
{
okButton->setEnabled(lineEdit->hasAcceptableInput());
}

When I try to run the application, I get the following errors:

C:/Users/avbder/Desktop/abder/debug/checkabder.o:-1: In function `CheckAbder':

C:\Users\avbder\Desktop\abder/checkabder.cpp:3: error: undefined reference to `vtable for CheckAbder'

C:\Users\avbder\Desktop\abder/checkabder.cpp:3: error: undefined reference to `vtable for CheckAbder'

C:\Users\avbder\Desktop\abder/checkabder.cpp:3: error: undefined reference to `vtable for CheckAbder'

C:\Users\avbder\Desktop\abder/checkabder.cpp:3: error: undefined reference to `vtable for CheckAbder'

:-1: error: collect2: ld returned 1 exi开发者_开发技巧t status

Any ideas on how to solve those issues?

Thanks.


It's looking for the reference to the first virtual method of CheckAbder(..), which it can't find.

Or, it could be just how your class is defined and an issue with your MOC file. See this blog post on undefined reference to vtable errors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜