• 8105阅读
  • 4回复

QLabel' undeclared (first use this function) [复制链接]

上一主题 下一主题
离线davalop
 
只看楼主 倒序阅读 楼主  发表于: 2009-03-06
— 本帖被 XChinux 执行加亮操作(2009-03-06) —
helloworld.cpp  helloworld.pro  Makefile
[root@localhost helloworld]# vi Makefile
[root@localhost helloworld]# ls
helloworld.cpp  helloworld.pro  Makefile
[root@localhost helloworld]# make
g++ -c -pipe -Wall -W -O2 -march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno-use
-cxa-atexit -fno-exceptions  -DQT_NO_DEBUG -I/usr/lib/qt-3.1/mkspecs/default -I.
-I. -I/2410s/qtopia/qt-2.3.10/include -o helloworld.o helloworld.cpp
helloworld.cpp:1:24: QApplication: 没有那个文件或目录
helloworld.cpp:2:18: QLabel: 没有那个文件或目录
helloworld.cpp:4: type specifier omitted for parameter `argv[]'
helloworld.cpp: In function `int main(int)':
helloworld.cpp:6: `QApplication' undeclared (first use this function)
helloworld.cpp:6: (Each undeclared identifier is reported only once for each
   function it appears in.)
helloworld.cpp:6: parse error before `(' token
helloworld.cpp:7: `QLabel' undeclared (first use this function)
helloworld.cpp:8: `hello' undeclared (first use this function)
helloworld.cpp:9: `app' undeclared (first use this function)
helloworld.cpp:5: warning: unused parameter `int argc'
make: *** [helloworld.o] Error 1
离线davalop
只看该作者 1楼 发表于: 2009-03-06
#include <QApplication>
#include <QLabel>

int main(int argc,argv[])
{
    QApplication app(argc,argc);
    QLabel hello("Hello World");
    hello.show();
    return app.exec();
}
离线guoyun_he

只看该作者 2楼 发表于: 2009-03-06
你直接给出文件名看看行不行!
离线浪漫天使
只看该作者 3楼 发表于: 2009-03-06
-I/2410s/qtopia/qt-2.3.10/include

你的是 qt2 ,又想用qt4的游戏规则玩,
不对版啊。。。
离线wd007

只看该作者 4楼 发表于: 2009-03-06
“cxa-atexit -fno-exceptions  -DQT_NO_DEBUG -I/usr/lib/qt-3.1/mkspecs/default -I.
-I. -I/2410s/qtopia/qt-2.3.10/include -o helloworld.o helloworld.cpp”

你的很乱阿,版本和写法不对应。

具体可参考这篇帖子:

http://www.qtkbase.com/read.php?tid=63&toread=1
欢迎访问我的博客,一起学习提高
http://blog.csdn.net/qter_wd007
快速回复
限100 字节
 
上一个 下一个