 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
kasiyil Guest
|
Posted: Mon Aug 21, 2006 9:10 am Post subject: Forward decleration of enumerations and typedefs in a NameSp |
|
|
Hello,
I have a compilation problem about namespaces:
I have a namespace X in which I declera a type definition:
In X.h file i write:
namespace X {
typedef unsigned int WindowHandle_t;
}
In a class which is in a different namespace ( Y ), I must use the type
definition I declared in namespace X.
MyClass.h file:
Y::MyClass {
....
private:
X::WindowHandle_t handle;
....
}
And the code doesn't compile. I should forward declare this handle type
definition but forward decleration is the same as writing the same
thing that I wrote in X.h file. When I write
In MyClass.h file :
namespace X {
typedef unsigned int WindowHandle_t;
}
Y::MyClass {
....
private:
X::WindowHandle_t handle;
....
}
The code compiles. But as I stated, I do not want to write same type
definition twice in a code. Do you have any suggestions?
Thanks... |
|
| Back to top |
|
 |
Ian Collins Guest
|
Posted: Mon Aug 21, 2006 9:10 am Post subject: Re: Forward decleration of enumerations and typedefs in a Na |
|
|
kasiyil wrote:
| Quote: | Hello,
I have a compilation problem about namespaces:
I have a namespace X in which I declera a type definition:
In X.h file i write:
namespace X {
typedef unsigned int WindowHandle_t;
}
In a class which is in a different namespace ( Y ), I must use the type
definition I declared in namespace X.
MyClass.h file:
Y::MyClass {
....
private:
X::WindowHandle_t handle;
....
}
And the code doesn't compile. I should forward declare this handle type
definition but forward decleration is the same as writing the same
thing that I wrote in X.h file. When I write
Have you included X.h? |
--
Ian Collins. |
|
| Back to top |
|
 |
kasiyil Guest
|
Posted: Mon Aug 21, 2006 9:11 am Post subject: Re: Forward decleration of enumerations and typedefs in a Na |
|
|
I included it after MyClass.h. There is no way to include it before
MyClass.h .
Ian Collins wrote:
| Quote: | kasiyil wrote:
Hello,
I have a compilation problem about namespaces:
I have a namespace X in which I declera a type definition:
In X.h file i write:
namespace X {
typedef unsigned int WindowHandle_t;
}
In a class which is in a different namespace ( Y ), I must use the type
definition I declared in namespace X.
MyClass.h file:
Y::MyClass {
....
private:
X::WindowHandle_t handle;
....
}
And the code doesn't compile. I should forward declare this handle type
definition but forward decleration is the same as writing the same
thing that I wrote in X.h file. When I write
Have you included X.h?
--
Ian Collins. |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|