Results 1 to 11 of 11

Thread: Error Compiling with cmd prmpt

  1. #1

    Default Error Compiling with cmd prmpt

    I am using windows and when I enter this command i get the following errors
    C:\>qmake yellow.cpp
    c:\yellow.cpp:4: Unknown test function: int main
    c:\yellow.cpp:6: Unknown test function: QApplicaiton app
    c:\yellow.cpp:6: Parse Error ('QApplicaiton app(argc, argv);')
    c:\yellow.cpp:6: Unterminated conditional block at end of file
    Error processing project file: yellow.cpp

    this is my yellow.cpp file

    Qt Code:
    1. #include<QApplication>
    2. #include<QLabel>
    3.  
    4. int main(int argc,char *argv[])
    5. {
    6. QApplicaiton app(argc, argv);
    7. QLabel *label=new QLabel("Yellow Fellows");
    8. label->show();
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Error Compiling with cmd prmpt

    'QApplication' is misspelled in line 6.
    I'm a rebel in the S.D.G.

  3. #3

    Default Re: Error Compiling with cmd prmpt

    thanks but i am still getting the error , can you tell me how to compile and run through Qt cmd prompt cause i might be wrong

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Error Compiling with cmd prmpt

    The program is right (except misspelled QApplication). It seems there is aome problem regarding your Qt installation. Please provide some more information about your build system and what procedure you are following to compile this code.

  5. #5

    Default Re: Error Compiling with cmd prmpt

    first I go into the folder where my .cpp file is , then i do qmake -project and then I do qmake yellow.cpp and then i get those errors

  6. #6
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Error Compiling with cmd prmpt

    Quote Originally Posted by messifanboy View Post
    then I do qmake yellow.cpp and then i get those errors
    This is the problem.
    You doesn't need to do that. Your 1st and second step was fine. So now your steps shall be.
    1. "QMake -poject" (To generate .pro file)
    2. "QMake" (To generate make files)
    3. "nmake" (To build the project with Microsoft compiler)

  7. #7

    Default Re: Error Compiling with cmd prmpt

    When i do the third step i get this
    'nmake' is not recognized as an internal or external command,
    operable program or batch file.

    And i just installed the Qt framework , don't have visual studio

  8. #8
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Error Compiling with cmd prmpt

    Quote Originally Posted by messifanboy View Post
    When i do the third step i get this
    'nmake' is not recognized as an internal or external command,
    operable program or batch file.
    This is because, it cannot find the compiler on your machine.
    Quote Originally Posted by messifanboy View Post
    And i just installed the Qt framework , don't have visual studio
    I assume, you used binary installer for that.
    In order to get your application running, you must have an IDE.
    Use QtCreator.

  9. #9

    Default Re: Error Compiling with cmd prmpt

    i have installed Qtcreator also but still get the problem

  10. #10
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Error Compiling with cmd prmpt

    Please use Creator tutorial and docs.

  11. #11
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Error Compiling with cmd prmpt

    If you don't have visual studio, you'll need to use mingw32:
    Qt Code:
    1. mingw32-make
    To copy to clipboard, switch view to plain text mode 
    Make sure mingw\bin dir is in your PATH. It will be in the same directory as LICENSE - one step up from $QTDIR, assuming you installed Windows framework including QtCreator (In which case using QtCreator itself would be much easier)

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
  •  
Qt is a trademark of The Qt Company.