470,588 Members | 2,187 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,588 developers. It's quick & easy.

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 3251
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

25 posts views Thread by kj | last post: by
7 posts views Thread by Kevin Newman | last post: by
4 posts views Thread by Kevin Newman | last post: by
reply views Thread by kaypohsingaporean | last post: by
14 posts views Thread by Jon Rea | last post: by
30 posts views Thread by Pep | last post: by
1 post views Thread by =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post: by
11 posts views Thread by =?Utf-8?B?SmVycnkgQw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.