装了QT4.3.4 同时在/etc/ofile设置好了环境变量,在终端输入export 显示 有QTDIR=“/usr/local/Trolltech/Qt-4.3.4"
PATH="/usr/local/Trolltech/Qt-4.3.4/bin:......(后面省略)"
LD_LIBRARY_PATH="/usr/local/Trolltech/Qt-4.3.4/lib:"
测试了两个程序:
1:#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
编译成功;能执行
但是第二个程序
#include <qapplication.h>
#include <qlabel.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("cnsilan", 0);
app.setMainWidget(label);
label->show();
return app.exec();
}
在make时出现如下错误:
.............
hello.cpp:In function 'int main(int,char**)';
hello.cpp:10:no matching function for call to 'QApplication::setMainWidget(QLabel*&)'
make:***【hello.o】 Erro1
请问是什么问题啊??? 谢谢