Strange Errors while compiling (QT Header Files)
Hi all,
So, I'm busy with this pretty large project and I've come across a strange error today.
The code I'm working on is seperated over about 20 different files, and it used to compile with some warnings (The code is not completely finished yet) but this very file that produces this error used to compile fine without any errors or warnings.
Yet somehow it suddenly produces errors like this:
Code:
In file included from ../Qt/4.4.3/include/QtCore/qnamespace.h:1,
from ../Qt/4.4.3/include/QtCore/../../src/corelib/kernel/qobjec
tdefs.h:41,
from ../Qt/4.4.3/include/QtCore/qobjectdefs.h:1,
from ../Qt/4.4.3/include/QtCore/../../src/corelib/kernel/qobjec
t.h:43,
from ../Qt/4.4.3/include/QtCore/qobject.h:1,
from ..
/Qt
/4.4.3
/include
/QtCore
/QObject:1,
from ReferenceStructureForm.h:2:
../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:50: error: synt
ax error before "namespace"
../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:54: error: synt
ax error before '{' token
../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:121: warning: r
eturn type defaults to `int'
../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h: In function `Q
_DECLARE_FLAGS':
../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:122: error: `Qt
' undeclared (first use in this function)
../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:122: error: (Ea
ch undeclared identifier is reported only once
../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:122: error: for
each function it appears in.)
../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:122: confused b
y earlier errors, bailing out
mingw32-make[1]: *** [release/ReferenceStructureForm.o] Error 1
mingw32-make[1]: Leaving directory `C:/TMP'
mingw32-make: *** [release] Error 2
The code that I'm trying to compile goes like this:
Header file:
Code:
#include <QObject>
#ifndef ReferenceStructureFormH
#define ReferenceStructureFormH
class QFormReferenceStructure
: public QObject{
Q_OBJECT
public:
QFormReferenceStructure(QViewerList *parent = 0);
bool DoShowReferenceStructureFile
(QString);
};
#endif
And the .cpp file:
Code:
#include "ReferenceStructureForm.h"
QFormReferenceStructure::QFormReferenceStructure(QViewerList *parent)
{
}
bool QFormReferenceStructure
::DoShowReferenceStructureFile(QString FileName
) {
return true;
}
The functions aren't realy doing anything yet, this was just for testing.
There are some threads about similar errors on the QTForum, but for answers they provided links to threads that no longer seem to exist.
Can anyone help me?
Thanks in advance!
Re: Strange Errors while compiling (QT Header Files)
could you try putting the header guard before #include <QObject>
Re: Strange Errors while compiling (QT Header Files)
Thanks for the reply.
I tried, but no luck...
It has to be something else I guess.
Re: Strange Errors while compiling (QT Header Files)
What's QViewerList? There may be the problem while casting to a QObject for the ctor of the base class. And better put the #include* inside the def.
EDIT: And it is confusing if you are naming your own classes like Qt. So you might want choose another letter to start you class names.
Re: Strange Errors while compiling (QT Header Files)
Quote:
Originally Posted by
Lykurg
There may be the problem while casting to a QObject for the ctor of the base class.
That would not result in a syntax error, would it? Sounds more like a missing ";" at the end of a class or something like that.
Re: Strange Errors while compiling (QT Header Files)
can you post the .pro file contents ?