By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

Problems with own namespace stat

P: n/a
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
Mar 20 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hansen wrote:
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.
Mar 20 '07 #2

P: n/a

"Fei Liu" <fe****@aepnetworks.comwrote in message
news:et**********@aioe.org...
Hansen wrote:
>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
Mar 20 '07 #3

P: n/a
On 20 Mar, 14:39, "Hansen" <bluesb...@-remove-this-hotmail.comwrote:
"Fei Liu" <fei...@aepnetworks.comwrote in message
news:et**********@aioe.org...
Hansen wrote:
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?
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

Mar 20 '07 #4

P: n/a
Hansen <bluesboys@-remove-this-hotmail.comwrote:
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
Mar 20 '07 #5

P: n/a
On Mar 20, 8:20 am, "Hansen" <bluesb...@-remove-this-hotmail.com>
wrote:
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

Mar 21 '07 #6

P: n/a

"Matteo" <ma****@ncsa.uiuc.eduwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
On Mar 20, 8:20 am, "Hansen" <bluesb...@-remove-this-hotmail.com>
wrote:
>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
Mar 23 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.