473,412 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

namespace issues

I got an rather large project which i recently startet to split up into
namespaces.
At a certain point the compiler (MSVC 6.0 sp5) began to give me C2871 errors
( 'name' : does not exist or is not a namespace ). I'am using an scheme
like this:

[header1.h]

namespace A {
// class declaration

}

[sourcefile1.cpp]
#include "header1.h"
#include<something>

namespace A{

// class definition
}

[header2.h]

namespace B {
// class declaration

}

[sourcefile2.cpp]
#include "header1.h"
#include "header2.h"
#include<something>

namespace B{
using namespace A; // error C2871
// class definition
}

Do you have any idea what i'm doing wrong? Or is this an compiler issue,
since i'm using 5-6 different namespaces distributet over 30 files and and
are cross referencing each other in the implementation sourcefiles.

I appreciate your help!
Oct 17 '05 #1
6 3405
This could be VC++ issue which does not belong to this group.

But first, have you figured out the msdn error discription?

http://msdn.microsoft.com/library/de...html/c2871.asp
You are sure, not running into one of these errors?

Regards,
Sascha

Oct 17 '05 #2

"eiji" <Sa*****@gmx.de> schrieb im Newsbeitrag
news:11*********************@g47g2000cwa.googlegro ups.com...
This could be VC++ issue which does not belong to this group.

But first, have you figured out the msdn error discription?

http://msdn.microsoft.com/library/de...html/c2871.asp You are sure, not running into one of these errors?

Regards,
Sascha


I'm aware of the purpose of errorcodes, and i always lookup all the sources
i know (including google) to solve a problem, before i would bother you with
my questions.

I'm sure i have declared the namespaces i reference and the that there are
no name clashes.
At least i did all the obvious stuff right.
Maybe there is a mistake caused by all the cross referenzing or the
preprozessor has deleted something.
I have no clue. I hope somebody had this Problem before and can give me a
hint to work around.

Regards
Steffen
Oct 17 '05 #3
Are you sure the #include<something> part doesn't declaire any symbols
that would generate nameclashes?

Just a sugestion - try prefix something to the namespace A (make it
temp_A or something like that), if the error is still there, then it's
not a nameclash for sure.

Steffen Hampel wrote:
"eiji" <Sa*****@gmx.de> schrieb im Newsbeitrag
news:11*********************@g47g2000cwa.googlegro ups.com...
This could be VC++ issue which does not belong to this group.

But first, have you figured out the msdn error discription?

http://msdn.microsoft.com/library/de...html/c2871.asp
You are sure, not running into one of these errors?

Regards,
Sascha


I'm aware of the purpose of errorcodes, and i always lookup all the sources
i know (including google) to solve a problem, before i would bother you with
my questions.

I'm sure i have declared the namespaces i reference and the that there are
no name clashes.
At least i did all the obvious stuff right.
Maybe there is a mistake caused by all the cross referenzing or the
preprozessor has deleted something.
I have no clue. I hope somebody had this Problem before and can give me a
hint to work around.

Regards
Steffen


Oct 17 '05 #4

"Steffen Hampel" <st************@s2000.tu-chemnitz.de> wrote in message
news:di**********@anderson.hrz.tu-chemnitz.de...
I got an rather large project which i recently startet to split up into
namespaces.
At a certain point the compiler (MSVC 6.0 sp5) began to give me C2871
errors
( 'name' : does not exist or is not a namespace ). I'am using an scheme
like this:

[header1.h]

namespace A {
// class declaration

}

[sourcefile1.cpp]
#include "header1.h"
#include<something>

namespace A{

// class definition
}

[header2.h]

namespace B {
// class declaration

}

[sourcefile2.cpp]
#include "header1.h"
#include "header2.h"
#include<something>

namespace B{
using namespace A; // error C2871
// class definition
}

Do you have any idea what i'm doing wrong? Or is this an compiler issue,
since i'm using 5-6 different namespaces distributet over 30 files and and
are cross referencing each other in the implementation sourcefiles.


I recreated your example above using VC6.0 (but I have SP6),
but without the #include<something> (what is that supposed to
represent?), and I got a clean compile with no errors.

Perhaps it's something (:-) ) in your <something> header?

-Mike

Oct 17 '05 #5
Mike Wahler schrieb:
"Steffen Hampel" <st************@s2000.tu-chemnitz.de> wrote in message
news:di**********@anderson.hrz.tu-chemnitz.de...
I got an rather large project which i recently startet to split up into
namespaces.
At a certain point the compiler (MSVC 6.0 sp5) began to give me C2871
errors
( 'name' : does not exist or is not a namespace ). I'am using an scheme
like this:

[header1.h]

namespace A {
// class declaration

}

[sourcefile1.cpp]
#include "header1.h"
#include<something>

namespace A{

// class definition
}

[header2.h]

namespace B {
// class declaration

}

[sourcefile2.cpp]
#include "header1.h"
#include "header2.h"
#include<something>

namespace B{
using namespace A; // error C2871
// class definition
}

Do you have any idea what i'm doing wrong? Or is this an compiler issue,
since i'm using 5-6 different namespaces distributet over 30 files and and
are cross referencing each other in the implementation sourcefiles.


I recreated your example above using VC6.0 (but I have SP6),
but without the #include<something> (what is that supposed to
represent?), and I got a clean compile with no errors.

Perhaps it's something (:-) ) in your <something> header?

-Mike


The #include<something> means that there are other headers included
besides the "header1.h" (standart STL headers as well as custum
headers).
if you have an idea what could be wrong in these headers, that affects
my templates, i would be happy to know.

I'm using VS6 SP5 since the SP6 doesn't work with the "processor Pack"
Update from M$.

-Steffen

Oct 19 '05 #6

<sp*******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Mike Wahler schrieb:
"Steffen Hampel" <st************@s2000.tu-chemnitz.de> wrote in message
news:di**********@anderson.hrz.tu-chemnitz.de...
>I got an rather large project which i recently startet to split up into
> namespaces.
> At a certain point the compiler (MSVC 6.0 sp5) began to give me C2871
> errors
> ( 'name' : does not exist or is not a namespace ). I'am using an
> scheme
> like this:
>
> [header1.h]
>
> namespace A {
> // class declaration
>
> }
>
> [sourcefile1.cpp]
> #include "header1.h"
> #include<something>
>
> namespace A{
>
> // class definition
> }
>
> [header2.h]
>
> namespace B {
> // class declaration
>
> }
>
> [sourcefile2.cpp]
> #include "header1.h"
> #include "header2.h"
> #include<something>
>
> namespace B{
> using namespace A; // error C2871
> // class definition
> }
>
> Do you have any idea what i'm doing wrong? Or is this an compiler
> issue,
> since i'm using 5-6 different namespaces distributet over 30 files and
> and
> are cross referencing each other in the implementation sourcefiles.
I recreated your example above using VC6.0 (but I have SP6),
but without the #include<something> (what is that supposed to
represent?), and I got a clean compile with no errors.

Perhaps it's something (:-) ) in your <something> header?

-Mike


The #include<something> means that there are other headers included
besides the "header1.h"


I suspected as much, but no way could anyone know without
your telling use.
(standart STL headers as well as custum
headers).
The standard headers shouldn't be a problem. But of course
there could easily be a problem in one or more of your
'custom' headers.
if you have an idea what could be wrong in these headers,

How on Earth could I know or guess without seeing them?
that affects
my templates, i would be happy to know.
The first thing to do would be to eliminate them. If the
problem goes away, then of course the problem is there.
Then start adding them back one at a time until the
problem reappears. That's a pretty basic problem-solving
technique.


I'm using VS6 SP5 since the SP6 doesn't work with the "processor Pack"
Update from M$.


I doubt that service pack version is the trouble.

-Mike
Oct 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: kj | last post by:
Consider the following XML document: <?xml version='1.0' encoding='UTF-8'?> <bar:foo xmlns:bar='someuri'> <baz/> </bar:foo> What namespace does baz belong to? What is this namespace bound...
7
by: Kevin Newman | last post by:
I've been toying with a namespace manager, and wanted to get some input. So what do you think? if (typeof com == 'undefined') var com = {}; if (!com.unFocus) com.unFocus = {}; ...
9
by: MDoyle | last post by:
Here is the easiest question you’ll get all day from a complete newbie. I installed Visual Studio on my laptop last night and have been tryin to write my very first C# programs this morning. I’m...
7
by: thechaosengine | last post by:
Hi all, Can anyone tell me if it is advisable (or even possible) to define a namespace across 2 or more assemblies? For example, consider the namespace SampleApplication.Data.Providers ...
4
by: Kevin Newman | last post by:
The primary problem I've had with php is the lack of namespaces, which makes OOP very difficult to organize, since you end up with large number of classes cluttering up the same namespace - which...
0
by: kaypohsingaporean | last post by:
Hi all, I am porting VC++6 code to VC++8/2005. Here's the original code: (I have replaced the greater than sign with &gt; because this forum's parser doesn't like it) template < class CharT,...
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
30
by: Pep | last post by:
Is it best to include the code "using namespace std;" in the source or should each keyword in the std namespace be qualified by the namespace tag, such as std::cout << "using std namespace" <<...
1
by: =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post by:
Thank you Wen Yuan, This did answer my question, but it took a lot of work to implement. My original code did not use any namespace so I had to modify and test some 3000 lines of code to make...
11
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a machine Windows Server 2003 using IIS 6.0 and I am getting the error BC30560 prjob_ascx is ambiguous in the namespace ASP I found a fix. Deleting all the files in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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,...

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.