Results 1 to 3 of 3

Thread: Error trying to compile a simple code: Q_OBJECT

  1. #1
    Join Date
    Jul 2009
    Posts
    12
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Error trying to compile a simple code: Q_OBJECT

    I have
    Qt Code:
    1. C:/Users/dimitar/Documents/trebovano-isporacano/mainWindow.h:14: error: ISO C++ forbids declaration of `Q_OBJECT' with no type
    To copy to clipboard, switch view to plain text mode 

    The code is :

    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #incluse <QMainWindow>
    5.  
    6. class mainWindow : public QMainWindow
    7. { Q_OBJECT
    8.  
    9. public:
    10. MainWindow();
    11. protected:
    12. void closeEvent(QCloseEvent *event);
    13.  
    14.  
    15.  
    16. }
    17.  
    18.  
    19. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    Whats the problem?

    just found out i wrote incluse instead of include . nvm delete the topic *
    Last edited by deemeetar; 4th November 2009 at 22:29.

  2. #2
    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 trying to compile a simple code: Q_OBJECT

    Looks to me like it can't find the include file

  3. #3
    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 trying to compile a simple code: Q_OBJECT

    Looks like you misspelled the word "include". And your class definition should end with a semi-colon.
    I'm a rebel in the S.D.G.

Similar Threads

  1. compile source code file
    By eva in forum Qt Programming
    Replies: 6
    Last Post: 16th March 2009, 11:15
  2. qtgui4.dll error in visual c++ 2005
    By Comptrol in forum Installation and Deployment
    Replies: 33
    Last Post: 19th June 2008, 07:18
  3. Too simple compile error to be found by me??!!!
    By MarkoSan in forum General Programming
    Replies: 6
    Last Post: 20th December 2007, 04:40
  4. Creating simple text editor from the eamples code
    By overcast in forum Qt Programming
    Replies: 4
    Last Post: 14th February 2007, 15:46
  5. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

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.