标题:用qmake编译不出main.o文件?
作者:flyingbug
日期:2006-05-19 16:28
内容:
我照着trolltech公司的那个flash教程写了一个Qt的HelpBrowser
不知道为什么编译的时候就是编译不出main.o文件(应该是在执行qmake的时候产生的.o文件吧)
我的main.cpp同flash里演示的都一样,如下:
#include "ui_browser.h"
#include
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
app.setQuitOnLastWindowClosed(true);
QMainWindow *form = new QMainWindow;
Ui::MainWindow ui;
ui.setupUi(form);
ui.textBrowser->setSource(QString("D:/Qt/4.1.0/doc/html/index.html"));
form->show();
return app.exec();
}
我用的是qt-4.0.0 for windows
#1 [flyingbug 05-19 16:44]
换了Qt-4.1.2,终于有报错信息了
main.cpp:1:24: ui_browser.h: No such file or directory
main.cpp: In function `int qMain(int, char**)':
main.cpp:10: error: `Ui' has not been declared
main.cpp:10: error: `MainWindow' undeclared (first use this function)
main.cpp:10: error: (Each undeclared identifier is reported only once for each f
unction it appears in.)
main.cpp:10: error: expected `;' before "ui"
main.cpp:11: error: `ui' undeclared (first use this function)
main.cpp:18:2: warning: no newline at end of file
make: *** [debug\main.o] Error 1
#2 [taii 07-05 22:36]
如果你的ui文件名为xxx,则应该是 #include ui_xxx.h,更好的办法是把ui保存为browser.ui
#3 [hau19820906 07-10 15:48]
文件你都没定义好啊
好好定义一下就好了