PDA

View Full Version : QtTest problem compiling basic testcase



hubbobubbo
9th December 2009, 16:29
Hi

I was trying to use QtTest for the first time with a simple example from the internet.

This is the code:

#include <QtTest>
#include <QtCore>

class TestQString: public QObject
{
Q_OBJECT
private slots:
void toUpper();
};

void TestQString::toUpper()
{
QString str = "Hello";
//COMPARE(str.toUpper(), QString("HELLO"));
}

QTTEST_MAIN(TestQString)
#include "testqstring.moc"


However when compiling I just get the errors below, all of them pointing at this line:
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_TestQString[] = {

Errors:

\debug\testqstring.moc(19) : error C3646: 'uint' : unknown override specifier
\debug\testqstring.moc(19) : error C3646: 'qt_meta_data_TestQString' : unknown override specifier
\debug\testqstring.moc(19) : error C2090: function returns array
\debug\testqstring.moc(19) : error C2270: 'QTTEST_MAIN' : modifiers not allowed on nonmember functions
\debug\testqstring.moc(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1\debug\testqstring.moc(19) : error C2072: 'QTTEST_MAIN' : initialization of a function
debug\testqstring.moc(22) : error C2078: too many initializers
\debug\testqstring.moc(44) : error C2065: 'qt_meta_data_TestQString' : undeclared identifier

hubbobubbo
14th December 2009, 11:38
*bump*

no one has encountered this problem. ?