LabRat 'Gotcha' moc not seeing namespace.
-
Hello everyone!
I am new at this, so please feel free to clout me one over the head if I'm mistaken here!I just found out that having a macro declared for a namespace seems to cause the moc compiler some grief.
eg;
@#define MY_BEGIN_NAMESPACE namespace MyNamespace {
#define MY_END_NAMESPACE }@implementation:
@#ifndef MY_TOOLS_H
#define MY_TOOLS_H#include <QObject>
#include "CommonDefinitionsQT.h"
MY_BEGIN_NAMESPACE
class MyTools : public QObject
{
...
}MY_END_NAMESPACE
@causes:
error C2653: 'MyTools' : is not a class or namespace nameCopied from the moc source file:
@// enum data: key, value
79, uint(MyTools::CRC_None),
88, uint(MyTools::CRC_8_Bit),
@As you can see, I have a few Q_ENUMS() declared.
As it seems, it is not appending the namespace to the 'MyTools class or adding a 'using namespace' declaration to the moc file.I'm using the latest version of QT with the Visual Studio edition.
By the way, I got this nifty idea from the QXT library where they seem to be using this just fine, so what am I doing wrong?
-
-
Thanks chetankjain for your response, I will give this a try over the weekend.
Regarding the ";" My apologies lyuts, this was just an oversight while typing into the forum, my code of course contains a ";" at the end of the class.
I will post a reply once I'm in a position to compile.
Cheers.
-
Well I recompiled and it works like a charm!.
Thanks for your help on the subject. I knew it would be a rookie mistake :)
I reckon the ";" is one of the most time wasting characters in the whole c language, I have spent hours tracking down these little you know whats... but I guess that why we like it!
Cheers.