当前位置: 技术问答>linux和unix
qt初学,编译不过去!
来源: 互联网 发布时间:2016-10-08
本文导语: #include "qapplication.h" #include "qmainwindow.h" int main(int argc,char **argv) { QApplication app(argc,argv); QMainWindow window(); app.setMainWidget(window); window.show(); return app.exec(); } [root@localhost src]# g++ -o qt1 qt1.cpp -I$QTDIR/include -L$QTDIR/lib...
#include "qapplication.h"
#include "qmainwindow.h"
int main(int argc,char **argv)
{
QApplication app(argc,argv);
QMainWindow window();
app.setMainWidget(window);
window.show();
return app.exec();
}
[root@localhost src]# g++ -o qt1 qt1.cpp -I$QTDIR/include -L$QTDIR/lib -lqt
qt1.cpp: In function `int main(int, char**)':
qt1.cpp:8: no matching function for call to `QApplication::setMainWidget(
QMainWindow (&)())'
/usr/lib/qt-3.1/include/qapplication.h:119: candidates are: virtual void
QApplication::setMainWidget(QWidget*)
qt1.cpp:9: request for member `show' in `window()', which is of non-aggregate
type `QMainWindow ()()'
redhat下面,qt使用包管理器进行安装!
#include "qmainwindow.h"
int main(int argc,char **argv)
{
QApplication app(argc,argv);
QMainWindow window();
app.setMainWidget(window);
window.show();
return app.exec();
}
[root@localhost src]# g++ -o qt1 qt1.cpp -I$QTDIR/include -L$QTDIR/lib -lqt
qt1.cpp: In function `int main(int, char**)':
qt1.cpp:8: no matching function for call to `QApplication::setMainWidget(
QMainWindow (&)())'
/usr/lib/qt-3.1/include/qapplication.h:119: candidates are: virtual void
QApplication::setMainWidget(QWidget*)
qt1.cpp:9: request for member `show' in `window()', which is of non-aggregate
type `QMainWindow ()()'
redhat下面,qt使用包管理器进行安装!
|
试试app.setMainWidget(&window);