PDA

View Full Version : error: expected class-name before '{' token



abrou
30th January 2008, 18:48
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 ==========



#ifndef COMPARE_H
#define COMPARE_H

#include <Qt>
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QComboBox>
#include <QtGui/QLineEdit>
#include <QtGui/QMainWindow>
#include <QtGui/QMenuBar>
#include <QtGui/QPushButton>
#include <QtGui/QStatusBar>
#include <QtGui/QToolBar>
#include <QtGui/QWidget>
#include "ui_compare.h"


class compare : public QMainWindow, private Ui::compare
{
Q_OBJECT

public:
compare(QMainWindow *parent = 0);
};


#endif

jpn
30th January 2008, 19:47
Did you name the form "compare"? I know you saved compare.ui, but did you actually write "compare" to form's objectName property?

abrou
30th January 2008, 20:06
That was exactly it! Thanks!