Results 1 to 2 of 2

Thread: asking question about my first qt programme

  1. #1
    Join Date
    Nov 2010
    Posts
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Default asking question about my first qt programme

    # include<QApplication>
    # include<QLabel>
    int main(int argc,char *argv[])
    {
    QAplication app(argc,argv);
    QLabel *label = new QLabel("hello QT");

    label->show();
    return app.exec();
    }

    thats my programme in qt
    i found the following errors on its compilation
    /home/lincom/hello/hello.pro:3: Unknown test function: int main
    /home/lincom/hello/hello.pro:5: Unknown test function:
    /home/lincom/hello/hello.pro:8: Unknown test function: label->show
    /home/lincom/hello/hello.pro:8: Parse Error ('label->show();')
    /home/lincom/hello/hello.pro:8: Unterminated conditional block at end of file
    Error processing project file: /home/lincom/hello/hello.pro
    Exited with code 3.
    Error while building project hello
    When executing build step 'QMake'

    i dont know how to rectify them
    i m new to Qt
    so please help me out.
    thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: asking question about my first qt programme

    Step 1: Learn C++

    You can not add C++ code to a .pro file. A .pro file is a Qt specific file that tells qmake how to build a Makefile.
    The Makefile is used to build the code, usually consisting of .cpp and .h files.
    Add your code to a .cpp file and reference it in the .pro file.

    If that is pure Klingon for you, start with learning C++, then what a toolchain is and how to use it, then try Qt again.

Similar Threads

  1. dirtyOnScreen() method of QWSServer is not working for my programme.
    By Ratheendrans in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 8th November 2010, 05:02
  2. XML question(s)
    By Zzoni in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2009, 22:39
  3. not able to compile my programme/Fedora
    By shobhit in forum Installation and Deployment
    Replies: 6
    Last Post: 9th October 2007, 16:29
  4. problem in qt hello world programme
    By u04f061 in forum Qt Programming
    Replies: 6
    Last Post: 9th March 2007, 11:39
  5. GUi or Not GUI - that is the question
    By bruccutler in forum Qt Programming
    Replies: 1
    Last Post: 23rd February 2007, 18:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.