Results 1 to 3 of 3

Thread: error: expected class-name before '{' token

  1. #1
    Join Date
    Jan 2008
    Location
    Vancouver, Canada
    Posts
    54
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default error: expected class-name before '{' token

    Hello, I am getting this error when trying to build my project, using VS 2005 express and qt 4 in windows xp. It seems like it should be a simple solution, but I can't seem to figure it out. I'm not even sure it's a problem directly related to Qt. Below is the readout and below that is the .h file. It's even more confusing, because it is almost identical to another class in my project, which doesn't have any trouble compiling. Thanks!

    RoboSearch.cpp:21:21: warning: extra tokens at end of #include directive
    RoboSearch.cpp:22:22: warning: extra tokens at end of #include directive
    In file included from RoboSearch.cpp:22:
    compare.h:31: error: expected class-name before '{' token
    In file included from RoboSearch.cpp:22:
    compare.h:39:7: warning: no newline at end of file
    RoboSearch.cpp: In member function `void RoboSearch::updateProgress(int, int)':
    RoboSearch.cpp:236: warning: passing `float' for converting 1 of `void QProgressBar::setValue(int)'
    RoboSearch.cpp:259:2: warning: no newline at end of file
    mingw32-make[1]: *** [release/RoboSearch.o] Error 1
    mingw32-make[1]: Leaving directory `c:/Documents and Settings/abrounstein/My Documents/Visual Studio 2005/Projects/RoboSearch/RoboSearch'
    mingw32-make: *** [release] Error 2
    Build log was saved at "file://c:\Documents and Settings\abrounstein\My Documents\Visual Studio 2005\Projects\RoboSearch\RoboSearch\Release\BuildL og.htm"
    RoboSearch - 1 error(s), 8 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Qt Code:
    1. #ifndef COMPARE_H
    2. #define COMPARE_H
    3.  
    4. #include <Qt>
    5. #include <QtCore/QVariant>
    6. #include <QtGui/QAction>
    7. #include <QtGui/QApplication>
    8. #include <QtGui/QButtonGroup>
    9. #include <QtGui/QComboBox>
    10. #include <QtGui/QLineEdit>
    11. #include <QtGui/QMainWindow>
    12. #include <QtGui/QMenuBar>
    13. #include <QtGui/QPushButton>
    14. #include <QtGui/QStatusBar>
    15. #include <QtGui/QToolBar>
    16. #include <QtGui/QWidget>
    17. #include "ui_compare.h"
    18.  
    19.  
    20. class compare : public QMainWindow, private Ui::compare
    21. {
    22. Q_OBJECT
    23.  
    24. public:
    25. compare(QMainWindow *parent = 0);
    26. };
    27.  
    28.  
    29. #endif
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 30th January 2008 at 19:46. Reason: missing [quote] and [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: error: expected class-name before '{' token

    Did you name the form "compare"? I know you saved compare.ui, but did you actually write "compare" to form's objectName property?
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    abrou (30th January 2008)

  4. #3
    Join Date
    Jan 2008
    Location
    Vancouver, Canada
    Posts
    54
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: error: expected class-name before '{' token

    That was exactly it! Thanks!

Similar Threads

  1. How to use Signal through direct connection
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 14th December 2007, 07:07
  2. Need help integrating sigc++ with a KDE3/Qt3 app
    By Valheru in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2007, 15:39
  3. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  4. Replies: 2
    Last Post: 4th May 2006, 19:17
  5. Qt 4.1 and KDE 3.5.1 on OSX 10.2.8
    By Ptero-4 in forum Installation and Deployment
    Replies: 6
    Last Post: 6th February 2006, 02:44

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.