[问题]QT4路径问题

软件和网站开发以及相关技术探讨
回复
qianyimao
帖子: 1
注册时间: 2007-05-30 13:52

[问题]QT4路径问题

#1

帖子 qianyimao » 2007-10-21 12:58

环境 Ubuntu7.10 + KDevelop 3.5.0 + QT4
用KDevelop创建工程过程如下:
Project->New Project->C++->Simple Hello world program
其他默认.
删除main函数后
输入如下代码:
#include <iostream>
#include <cstdlib>
#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->show();
return app.exec();
}
在Automake Manager ->Options(with RMB)
在Inludes里的Directories outside project里添加
-I/usr/include/qt4/QtCore
-I/usr/include/qt4/QtGui
-I/usr/include/qt4
F8编译后还是出现以下错误:
error: QApplication: No such file or directory
error: QLabel: No such file or directory
: In function ‘int main(int, char**)’:
error: ‘QApplication’ was not declared in this scope
error: expected `;' before ‘app’
error: ‘QLabel’ was not declared in this scope
error: ‘label’ was not declared in this scope
error: expected type-specifier before ‘QLabel’
error: expected `;' before ‘QLabel’
error: ‘app’ was not declared in this scope

请问大家怎么解决,小弟感激涕零......
alabor
帖子: 113
注册时间: 2007-03-17 13:16

#2

帖子 alabor » 2007-10-31 13:29

我也存在这样的问题,不知道该如何解决。哪位大侠可以帮忙解决呢?
头像
marsteel
帖子: 555
注册时间: 2005-11-28 12:09
联系:

#3

帖子 marsteel » 2007-10-31 14:22

看我传的图就能明白
附件
Screenshot-KDevelop.png
Screenshot-KDevelop2.png
alabor
帖子: 113
注册时间: 2007-03-17 13:16

#4

帖子 alabor » 2007-10-31 19:21

3楼的太棒了,真不知道这些东西是从哪里学来的。毕竟在所有的帮助文件里面都没有啊!
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#5

帖子 eexpress » 2007-10-31 19:24

字体搞好看点,再贴图嘛。 :lol:
● 鸣学
回复