新手提问,编译时错误请大家帮忙看下。谢谢了
Tommy 2009-12-23 11:20:30 这是头文件
#include "QDialog"
#include "GoToCellDialog.h"
class MyDiaglo : public QDialog , public Ui::GoToCellDiaglo
{
Q_OBJECT
public:
MyDiaglo(QWidget *parent = 0);
private slots:
void on_lineEdit_textChanged();
};
源文件
#include "MyDiaglo.h"
#include "QtGui"
MyDiaglo::MyDiaglo(QWidget *parent)
:QDialog(parent)
{
setupUi(this);
RegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
lineEdit->setValidator(new QRegExpValidator(regExp,this));
connect(pushButton,SIGNAL(clicked()),this,SLOT(accept()));
connect(pushButton_2 , SIGNAL(clicked()) , this , SLOT(reject()));
}
void MyDiaglo::on_lineEdit_textChanged()
{
pushButton->setEnabled(lineEdit->hasAcceptableInput());
}
编译时出的错误是:
1>------ 已启动生成: 项目: QT-test, 配置: Release Win32 ------
1>正在链接...
1>MyDiaglo.obj : error LNK2001: 无法解析的外部符号 "public: virtual int __thiscall MyDiaglo::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MyDiaglo@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
1>MyDiaglo.obj : error LNK2001: 无法解析的外部符号 "public: virtual void * __thiscall MyDiaglo::qt_metacast(char const *)" (?qt_metacast@MyDiaglo@@UAEPAXPBD@Z)
1>MyDiaglo.obj : error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall MyDiaglo::metaObject(void)const " (?metaObject@MyDiaglo@@UBEPBUQMetaObject@@XZ)
1>C:\Users\熊猫\Documents\Visual Studio 2005\Projects\QT-test\Release\QT-test.exe : fatal error LNK1120: 3 个无法解析的外部命令
1>生成日志保存在“file://c:\Users\熊猫\Documents\Visual Studio 2005\Projects\QT-test\QT-test\Release\BuildLog.htm”
1>QT-test - 4 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========
//如果把以下代码注释掉就能正常编译了。
MyDiaglo::MyDiaglo(QWidget *parent)
:QDialog(parent)
{
setupUi(this);
RegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
lineEdit->setValidator(new QRegExpValidator(regExp,this));
connect(pushButton,SIGNAL(clicked()),this,SLOT(accept()));
connect(pushButton_2 , SIGNAL(clicked()) , this , SLOT(reject()));
}
小弟初学QT,请哪位大虾指点下。。