c++ - Compiling and running a Qt program -


I am new to Qt , and am trying to compile and run this QT program Programming with QT :

  #include & lt; Qapplication.h & gt; # Include & lt; Qlabel.h & gt; Int main (int argc, char * argv []) {QApplication myapp (argc, argv); QLabel * mylabel = new QLabel ("hello", 0); Mylabel- & gt; (120,30); Myapp.setMainWidget (mylabel); Mylabel- & gt; Show (); Return myapp.exec (); }   

When I do this: C: \ Qt \ 2010.05 \ qt> gcc label.cc at Qt command prompt The following is available:

  label.cc:1:26: Error: qapplication.h: There is no such file or directory label. Ck20: Error: qlabel.h: Not File or Directory label.cc: 'int main (int, char **)' in function: label.cc :: error: did not declare 'QApplication' in this type of label I went. Rcc: Error: Expected ';' Prior to 'Myapp' label.cc:6: Error: This scope label was not declared 'QLabel' .cc: 6: Error: This scope label was not declared 'mylabel' .cc: 6: Error : Required type-specifier 'QLabel' label. Cc: before 6: Error: Expected ';' 'QLabel' before label.cc:8: Error: 'myapp' was not declared in this area   

Why is this so? What have I done to compile the Qt program?

Thank you.

  qmake -project qmake   

The first line creates a project file, creates a makefile from another project file and creates a project.

Comments