PDA

View Full Version : asking question about my first qt programme



raman1507
23rd November 2010, 15:03
# 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

tbscope
23rd November 2010, 15:12
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.