Connecting Tech Pros Worldwide Forums | Help | Site Map

Problems with own namespace stat

Hansen
Guest
 
Posts: n/a
#1: Mar 20 '07
Hi Group,

I've made a statistic module for our framework, and have put it in a
namespace called stat (which resides in a namespace called dao)
My problem is that now the compiler thinks that it is the struct called stat
from wchar.h that I'm refering to even though I've written
dao::stat::stat_base

I have included the stat_base.h header and have checked for using
statements, but nothing seems to work.

#include "dao/stat/stat_base.h"
namespace dao
{
[ ....]
void attach(dao::stat::stat_base& stat_client) <--- compiler barfs
{
stat_client.attach(this->impl_ptr());
}
}

I'm using visual C++ 2005 Express

Does anyone know what might be the problem and the solution?

/Hansen



Fei Liu
Guest
 
Posts: n/a
#2: Mar 20 '07

re: Problems with own namespace stat


Hansen wrote:
Quote:
Hi Group,
>
I've made a statistic module for our framework, and have put it in a
namespace called stat (which resides in a namespace called dao)
My problem is that now the compiler thinks that it is the struct called stat
from wchar.h that I'm refering to even though I've written
dao::stat::stat_base
>
I have included the stat_base.h header and have checked for using
statements, but nothing seems to work.
>
#include "dao/stat/stat_base.h"
namespace dao
{
[ ....]
void attach(dao::stat::stat_base& stat_client) <--- compiler barfs
{
stat_client.attach(this->impl_ptr());
}
}
>
I'm using visual C++ 2005 Express
>
Does anyone know what might be the problem and the solution?
>
/Hansen
>
>
Post a complete compilable test code that demonstrates your problem, you
can check it against dinku or comeau to test it out.
Hansen
Guest
 
Posts: n/a
#3: Mar 20 '07

re: Problems with own namespace stat



"Fei Liu" <feiliu@aepnetworks.comwrote in message
news:etoqb9$uqd$1@aioe.org...
Quote:
Hansen wrote:
Quote:
>Hi Group,
>>
>I've made a statistic module for our framework, and have put it in a
>namespace called stat (which resides in a namespace called dao)
>My problem is that now the compiler thinks that it is the struct called
>stat from wchar.h that I'm refering to even though I've written
>dao::stat::stat_base
>>
>I have included the stat_base.h header and have checked for using
>statements, but nothing seems to work.
>>
>#include "dao/stat/stat_base.h"
>namespace dao
>{
>[ ....]
> void attach(dao::stat::stat_base& stat_client) <--- compiler barfs
> {
> stat_client.attach(this->impl_ptr());
> }
>}
>>
>I'm using visual C++ 2005 Express
>>
>Does anyone know what might be the problem and the solution?
>>
>/Hansen
Post a complete compilable test code that demonstrates your problem, you
can check it against dinku or comeau to test it out.
The code base is very large and complex - posting it here doesn't seem as an
option.
I've tested something else though. If I change the name of my namespace to
e.g. statistic it still isn't able to find it.
I'm pusled by this, since I have included my header file with the namespace
as posted above, and therefore thought it would be accesable.

/Hansen


Gavin Deane
Guest
 
Posts: n/a
#4: Mar 20 '07

re: Problems with own namespace stat


On 20 Mar, 14:39, "Hansen" <bluesb...@-remove-this-hotmail.comwrote:
Quote:
"Fei Liu" <fei...@aepnetworks.comwrote in message
news:etoqb9$uqd$1@aioe.org...
Quote:
Hansen wrote:
Quote:
Hi Group,
>
Quote:
Quote:
I've made a statistic module for our framework, and have put it in a
namespace called stat (which resides in a namespace called dao)
My problem is that now the compiler thinks that it is the struct called
stat from wchar.h that I'm refering to even though I've written
dao::stat::stat_base
>
Quote:
Quote:
I have included the stat_base.h header and have checked for using
statements, but nothing seems to work.
>
Quote:
Quote:
#include "dao/stat/stat_base.h"
namespace dao
{
[ ....]
void attach(dao::stat::stat_base& stat_client) <--- compiler barfs
{
stat_client.attach(this->impl_ptr());
}
}
>
Quote:
Quote:
I'm using visual C++ 2005 Express
>
Quote:
Quote:
Does anyone know what might be the problem and the solution?
>
Quote:
Post a complete compilable test code that demonstrates your problem, you
can check it against dinku or comeau to test it out.
>
The code base is very large and complex - posting it here doesn't seem as an
option.
Not the whole code base, just a minimal but complete program that
demonstrates your problem and nothing else, as per the FAQ guidelines:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

See Thomas Tutone's post here for how and why

http://groups.google.co.uk/group/com...0bb7ea8a166a57

Gavin Deane

Marcus Kwok
Guest
 
Posts: n/a
#5: Mar 20 '07

re: Problems with own namespace stat


Hansen <bluesboys@-remove-this-hotmail.comwrote:
Quote:
Hi Group,
>
I've made a statistic module for our framework, and have put it in a
namespace called stat (which resides in a namespace called dao)
My problem is that now the compiler thinks that it is the struct called stat
from wchar.h that I'm refering to even though I've written
dao::stat::stat_base
>
I have included the stat_base.h header and have checked for using
statements, but nothing seems to work.
>
#include "dao/stat/stat_base.h"
namespace dao
{
[ ....]
void attach(dao::stat::stat_base& stat_client) <--- compiler barfs
{
stat_client.attach(this->impl_ptr());
}
}
>
I'm using visual C++ 2005 Express
>
Does anyone know what might be the problem and the solution?
[OT] Check your setting for "Treat wchar_t as a native type":
http://msdn2.microsoft.com/en-us/library/dh8che7s.aspx

On Visual Studio .NET 2003, it defaulted to "off", but from what I see
they switched it in 2005, but it wouldn't hurt to check it anyway.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Matteo
Guest
 
Posts: n/a
#6: Mar 21 '07

re: Problems with own namespace stat


On Mar 20, 8:20 am, "Hansen" <bluesb...@-remove-this-hotmail.com>
wrote:
Quote:
Hi Group,
>
I've made a statistic module for our framework, and have put it in a
namespace called stat (which resides in a namespace called dao)
My problem is that now the compiler thinks that it is the struct called stat
from wchar.h that I'm refering to even though I've written
dao::stat::stat_base
>
I have included the stat_base.h header and have checked for using
statements, but nothing seems to work.
>
#include "dao/stat/stat_base.h"
namespace dao
{
[ ....]
void attach(dao::stat::stat_base& stat_client) <--- compiler barfs
I might be wrong here, but since you are already in namespace dao,
won't the compiler look for stat_base in dao::dao::stat? Perhaps you
could fix it with:
void attach(::dao::stat::stat_base& stat_client)
^^---give a fully qualified name.

-matt

Hansen
Guest
 
Posts: n/a
#7: Mar 23 '07

re: Problems with own namespace stat



"Matteo" <mahall@ncsa.uiuc.eduwrote in message
news:1174493174.274248.205090@e65g2000hsc.googlegr oups.com...
Quote:
On Mar 20, 8:20 am, "Hansen" <bluesb...@-remove-this-hotmail.com>
wrote:
Quote:
>Hi Group,
>>
>I've made a statistic module for our framework, and have put it in a
>namespace called stat (which resides in a namespace called dao)
>My problem is that now the compiler thinks that it is the struct called
>stat
>from wchar.h that I'm refering to even though I've written
>dao::stat::stat_base
>>
>I have included the stat_base.h header and have checked for using
>statements, but nothing seems to work.
>>
>#include "dao/stat/stat_base.h"
>namespace dao
>{
>[ ....]
> void attach(dao::stat::stat_base& stat_client) <--- compiler barfs
>
I might be wrong here, but since you are already in namespace dao,
won't the compiler look for stat_base in dao::dao::stat? Perhaps you
could fix it with:
void attach(::dao::stat::stat_base& stat_client)
^^---give a fully qualified name.
I found out the problem was caused by cyclic including. Having terminated
the circle everything works fine.

/Hansen


Closed Thread