Qt-interest Archive, March 2002
Odd compilation problem (qt 2.3.0 nc/ Win)
Message 1 in thread
Hi.
I have a strange problem compiling one of my classes.
The class QCData contains the following definitions for public slots:
---- cut here ----
public slots:
// save the current data set to <filename> or to
// the old filename if none was given. If no old filename
// is defined, open file chooser widget to ask for one.
void save(const QString &filename = QString::null,
const bool ask=false);
// always ask or filename if askfile is true. If it is false
// just act like save();
void save(const bool ask);
// save to <f>, overwriting if it exists,
void save(QFile &f);
---- cut here ----
While the qcdata.h file as well as qcdata.cpp compile ok, the
moc_qcdata.cpp generated by moc doesn't. cl (Visual Studio 6) reports:
---- cut here ----
> e:\projekte\qcugas\moc_qcdata.cpp(69) : error C2440: 'initializing' : '' kann nicht in 'void (__thiscall QCData::*)(const class QString &)' konvertiert werden
> Keine Funktion mit diesem Namen im Gueltigkeitsbereich stimmt mit dem Zieltyp ueberein
---- cut here ----
I guess the english version of VS6 would report:
---- cut here ----
> e:\projekte\qcugas\moc_qcdata.cpp(69) : error C2440: 'initializing' : '' can't be converted to 'void (__thiscall QCData::*)(const class QString &)'
> No function with this name with current scope has the right target type.
---- cut here ----
A snippet from moc_qcdata.cpp might help finding out what went wrong:
---- cut here ----
typedef void(QCData::*m1_t0)(const QString&);
typedef void(QCData::*m1_t1)(const QString&);
typedef void(QCData::*m1_t2)(const bool);
typedef void(QCData::*m1_t3)(QFile&);
typedef void(QCData::*m1_t4)(const QString&);
typedef void(QCData::*m1_t5)(const QString&);
typedef void(QCData::*m1_t6)(const QString&);
typedef void(QCData::*m1_t7)(const QDate&);
typedef void(QCData::*m1_t8)(const QDateTime&);
typedef void(QCData::*m1_t9)(const QString&);
m1_t0 v1_0 = Q_AMPERSAND QCData::load;
> m1_t1 v1_1 = Q_AMPERSAND QCData::save;
m1_t2 v1_2 = Q_AMPERSAND QCData::save;
m1_t3 v1_3 = Q_AMPERSAND QCData::save;
m1_t4 v1_4 = Q_AMPERSAND QCData::setFilename;
m1_t5 v1_5 = Q_AMPERSAND QCData::setLastname;
m1_t6 v1_6 = Q_AMPERSAND QCData::setFirstname;
m1_t7 v1_7 = Q_AMPERSAND QCData::setBirthday;
m1_t8 v1_8 = Q_AMPERSAND QCData::setMeasuretime;
m1_t9 v1_9 = Q_AMPERSAND QCData::setComment;
---- cut here ----
The line with the ">" in front is the one that the error message
refers to.
I can't see anything wrong with my code, as far as I can tell, the
slot should work fine.
Is anybody able to tell me what I did wrong? Or did I stumble across a
bug in QT230NC?
cu,
sven
--
[ signature omitted ]