红联Linux门户
Linux帮助

Qt编译出错,求前辈们帮忙解答

发布时间:2009-12-03 23:10:09来源:红联作者:chentao0919
[i=s] 本帖最后由 chentao0919 于 2009-12-4 19:25 编辑 [/i]

安装好了qt-x11,现在编译hello程序make老是出错
就是说:
QApplication:没有那个文件或目录
QLable:没有那个文件或目录
……
……
这是什么原因啊,也在网上找过相关的,什么环境变量的设置之类的,按照他们说的改了都没有用,
麻烦问下前辈们这是什么原因呢?

#include
#include

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->show();

return app.exec();
}
文章评论

共有 5 条评论

  1. linshao.Solin 于 2010-01-08 13:32:25发表:

    #include
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    **********
    return a.exec();
    }
    这些是最基本的代码

  2. linshao.Solin 于 2010-01-08 13:31:01发表:

    在Linux下,你这个是缺少两个文件的吧,最好卸掉,然后再装,这是没装完整的样子,最新版得出来了,好用RPM包装吧

  3. chentao0919 于 2009-12-04 19:25:42发表:

    3# 396886380


    都加了啊,程序就是上面的那个,

  4. 396886380 于 2009-12-04 19:21:50发表:

    你是不是调用了什么函数?

    相关的头文件加了没?

    用make 不行,你就直接用gcc编辑试试看。

    可以把你具体的程序贴出来。

  5. chentao0919 于 2009-12-04 19:18:17发表:

    具体错误是这样子的:
    helloworld.cpp:1:23: qapplication.h: No such file or directory
    helloworld.cpp:1:17: qlabel.h: No such file or directory
    helloworld.cpp: In function 'int main(int,char**)':
    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)