473,467 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problems with own namespace stat

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
6 1749
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

"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
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
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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steven T. Hatton | last post by:
I found the following two statements in the file linked below: struct stat st; stat(fileName.c_str(), &st); http://websvn.kde.org/branches/work/kdevelop4-parser/main.cpp?rev=420247&view=markup...
0
by: Nuno Esculcas | last post by:
Hello, I'm a programer of C++ that recently move to C# and i now have some simple problems, like how to fill the following variable: System.Drawing.Imaging.EncoderParameters encoderParameters;...
3
by: David Bear | last post by:
I'm trying to use os.chmod and am refered to the stat module. Is there are explanation of: * S_ISUID * S_ISGID * S_ENFMT * S_ISVTX * S_IREAD * S_IWRITE * S_IEXEC
2
by: Michael Glassford | last post by:
The Python 2.5 News at http://www.python.org/download/releases/2.5/NEWS.txt states that Python 2.5 was changed to "Use Win32 API to implement os.stat/fstat. As a result, subsecond timestamps are...
9
by: Sheldon | last post by:
Good day Everyone, I am a still very new at learning C and I have thrown myself in the deep end. I started with a simple program and kept widening the scope. This has taught me many things about...
1
by: jmalone | last post by:
I have a python script that I need to freeze on AIX 5.1 (customer has AIX and does not want to install Python). The python script is pretty simple (the only things it imports are sys and socket)....
24
by: Joe Salmeri | last post by:
I just upgraded from Python 2.4.2 to Python 2.5.1 and have found some unexpected behavior that appears to be a bug in the os.stat module. My OS is Windows XP SP2 + all updates. I have several...
2
by: patrickdepinguin | last post by:
Hi, I use zlib to write data structures to a compressed file, using the gzwrite function. Afterwards I read the data back with gzread. I notice that this works well when the data written is not...
3
by: Deniz Dogan | last post by:
Hello. I have a question regarding the st_mode field of the "stat" struct in sys/stat.h. I'd like to know how to use the S_IRWXU, S_IRWXG and S_IRWXO flags to mask the mode_t value into human...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.