K
kk565
Apologies if this has been asked already, but my searches have turned up
nothing.
I have a class declaration inside a header file similar to this:
struct MyClass
{
class mytype_a *m1;
class mynamespace1::mynamespace2::mytype_b *m2;
};
Whereas just mytype_a compiles just fine, at the second member
declaration the compiler (GCC 4) gives the error:
‘mynamespace1’ has not been declared
My assumption was that since this is a just a pointer declaration, the
compiler would not need to know the actual details of the type (at least
at this stage)
To fix this, does it mean that I have to include the header file
containing the mytype_b type (and all namespace declarations)? or is
there a way of just letting the compiler know about these namespaces
without including the actual declarations?
Also my first instinct was to use something like this
struct MyClass
{
using namespace mynamespace1;
};
however this appears not be valid C++. Is there anyway of declaring used
namespaces or components from namespaces within a class
declaration/implementation?
Thanks in advance.
nothing.
I have a class declaration inside a header file similar to this:
struct MyClass
{
class mytype_a *m1;
class mynamespace1::mynamespace2::mytype_b *m2;
};
Whereas just mytype_a compiles just fine, at the second member
declaration the compiler (GCC 4) gives the error:
‘mynamespace1’ has not been declared
My assumption was that since this is a just a pointer declaration, the
compiler would not need to know the actual details of the type (at least
at this stage)
To fix this, does it mean that I have to include the header file
containing the mytype_b type (and all namespace declarations)? or is
there a way of just letting the compiler know about these namespaces
without including the actual declarations?
Also my first instinct was to use something like this
struct MyClass
{
using namespace mynamespace1;
};
however this appears not be valid C++. Is there anyway of declaring used
namespaces or components from namespaces within a class
declaration/implementation?
Thanks in advance.