Simple namespace question
Hi
I apologize if this is more of a C++ question, but I believe that it has a really simple answer.
I'm using namespaces in one of my libraries, and I have the following:
Code:
namespace MyNameSpace {
class MyClass {
MyClass();
~MyClass();
};
}
Now, whenever I call getWidget(), I get the following error message.
error: cannot convert `QWidget*' to `MyNameSpace::QWidget*' in assignment.
What am I doing wrong? I don't understand why it would think that QWidget is part of the namespace.
Thanks for any advice.
Jaco Naude
Re: Simple namespace question
How do you call it? Show us the source code.
Re: Simple namespace question
You probably have a "class QWidget" or "#include <QWidget>" statement inside the namespace. Move it outside (or add it there if you don't have it already) and the problem should go away.
Re: Simple namespace question
Aha! Thanks for the responses. It seems like a "class QWidget;" forward declaration did indeed slip into the wrong place inside the namespace.
Thanks for the help.