PDA

View Full Version : Class Confusion



Petr_Kropotkin
23rd January 2010, 00:04
#ifndef CALENDARTIME_H
#define CALENDARTIME_H

#include <QWidget>
#include "ui_calendar-time.h"


class CT : public QWidget, public Ui::Calendar-Time
{
Q_OBJECT
public:
CT(CT *parent = 0);
~CT();
void setColumnRange(QChar first, QChar last);


};

#endif // CALENDARTIME_H


#include <QtGui/QApplication>
#include "calendar-time.h"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
CT w;
CT.show();
return a.exec();
}


These are the errors:
calendar-time.h:8: error: expected class-name before '-' token
calendar-time.h:8: error: expected '{' before '-' token
calendar-time.h:8: error: expected unqualified-id before '-' token
mingw32-make[1]: *** [debug/main.o] Error 1

I tried a qmake it doesn't help. I seem to always get this problem. :confused








[/CODE]

RSX
23rd January 2010, 00:29
You can't use '-' character in names of variables, classes, objects. Use '_' instead.

Petr_Kropotkin
23rd January 2010, 01:03
I did that and got these errors
In file included from main.cpp:2:
calendartime.h:8: error: expected '{' before 'public'
calendartime.h:8: error: expected unqualified-id before 'public'

I seem to hit this errors alot. I drives me nuts

yxtx1984
23rd January 2010, 01:53
Maybe the problem is in line 12

CT(CT *parent = 0);

the parameter is wrong.

vishwajeet.dusane
23rd January 2010, 05:37
Hi

It seems lost of correction are required during design of this class.

First please check public Ui::Calendar-Time is correct. i.e. name space name

Petr_Kropotkin
23rd January 2010, 15:23
Here is the namespace.
I changed it from Calendar-Time to CalendarTime

namespace Ui {
class CTDialog: public Ui_CalendarTime{};
} //