• 5588阅读
  • 3回复

用qmake编译不出main.o文件? [复制链接]

上一主题 下一主题
离线flyingbug
 
只看楼主 倒序阅读 楼主  发表于: 2006-05-19
我照着trolltech公司的那个flash教程写了一个Qt的HelpBrowser

不知道为什么编译的时候就是编译不出main.o文件(应该是在执行qmake的时候产生的.o文件吧)

我的main.cpp同flash里演示的都一样,如下:
  1. #include "ui_browser.h"
  2. #include <QtGui/QtGui>
  3. int main(int argc,char *argv[])
  4. {
  5.   QApplication app(argc,argv);
  6.   app.setQuitOnLastWindowClosed(true);
  7.  
  8.   QMainWindow *form = new QMainWindow;
  9.   Ui::MainWindow ui;
  10.   ui.setupUi(form);
  11.  
  12.   ui.textBrowser->setSource(QString("D:/Qt/4.1.0/doc/html/index.html"));
  13.  
  14.   form->show();
  15.   return app.exec();
  16.  
  17. }


我用的是qt-4.0.0 for windows
[ 此贴被XChinux在2006-05-19 17:17重新编辑 ]
离线flyingbug
只看该作者 1楼 发表于: 2006-05-19
换了Qt-4.1.2,终于有报错信息了

  1. main.cpp:1:24: ui_browser.h: No such file or directory
  2. main.cpp: In function `int qMain(int, char**)':
  3. main.cpp:10: error: `Ui' has not been declared
  4. main.cpp:10: error: `MainWindow' undeclared (first use this function)
  5. main.cpp:10: error: (Each undeclared identifier is reported only once for each f
  6. unction it appears in.)
  7. main.cpp:10: error: expected `;' before "ui"
  8. main.cpp:11: error: `ui' undeclared (first use this function)
  9. main.cpp:18:2: warning: no newline at end of file
  10. make: *** [debug\main.o] Error 1
离线taii

只看该作者 2楼 发表于: 2006-07-05
如果你的ui文件名为xxx,则应该是 #include ui_xxx.h,更好的办法是把ui保存为browser.ui
离线hau19820906
只看该作者 3楼 发表于: 2006-07-10
文件你都没定义好啊
好好定义一下就好了
快速回复
限100 字节
 
上一个 下一个