Connecting Tech Pros Worldwide Forums | Help | Site Map

namespace issues

Steffen Hampel
Guest
 
Posts: n/a
#1: Oct 17 '05
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!



eiji
Guest
 
Posts: n/a
#2: Oct 17 '05

re: namespace issues


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

Steffen Hampel
Guest
 
Posts: n/a
#3: Oct 17 '05

re: namespace issues



"eiji" <SaLeuth@gmx.de> schrieb im Newsbeitrag
news:1129548055.411577.84980@g47g2000cwa.googlegro ups.com...[color=blue]
> This could be VC++ issue which does not belong to this group.
>
> But first, have you figured out the msdn error discription?
>
>[/color]
http://msdn.microsoft.com/library/de...html/c2871.asp[color=blue]
> You are sure, not running into one of these errors?
>
> Regards,
> Sascha[/color]

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


paulius-maruska
Guest
 
Posts: n/a
#4: Oct 17 '05

re: namespace issues


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:[color=blue]
> "eiji" <SaLeuth@gmx.de> schrieb im Newsbeitrag
> news:1129548055.411577.84980@g47g2000cwa.googlegro ups.com...[color=green]
> > This could be VC++ issue which does not belong to this group.
> >
> > But first, have you figured out the msdn error discription?
> >
> >[/color]
> http://msdn.microsoft.com/library/de...html/c2871.asp[color=green]
> > You are sure, not running into one of these errors?
> >
> > Regards,
> > Sascha[/color]
>
> 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[/color]

Mike Wahler
Guest
 
Posts: n/a
#5: Oct 17 '05

re: namespace issues



"Steffen Hampel" <steffen.hampel@s2000.tu-chemnitz.de> wrote in message
news:divrr3$k6u$1@anderson.hrz.tu-chemnitz.de...[color=blue]
>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.[/color]

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



spacksack@gmail.com
Guest
 
Posts: n/a
#6: Oct 19 '05

re: namespace issues


Mike Wahler schrieb:
[color=blue]
> "Steffen Hampel" <steffen.hampel@s2000.tu-chemnitz.de> wrote in message
> news:divrr3$k6u$1@anderson.hrz.tu-chemnitz.de...[color=green]
> >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.[/color]
>
> 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[/color]

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

Mike Wahler
Guest
 
Posts: n/a
#7: Oct 20 '05

re: namespace issues



<spacksack@gmail.com> wrote in message
news:1129720740.965516.112830@g14g2000cwa.googlegr oups.com...[color=blue]
> Mike Wahler schrieb:
>[color=green]
>> "Steffen Hampel" <steffen.hampel@s2000.tu-chemnitz.de> wrote in message
>> news:divrr3$k6u$1@anderson.hrz.tu-chemnitz.de...[color=darkred]
>> >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.[/color]
>>
>> 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[/color]
>
> The #include<something> means that there are other headers included
> besides the "header1.h"[/color]

I suspected as much, but no way could anyone know without
your telling use.
[color=blue]
>(standart STL headers as well as custum
> headers).[/color]

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.
[color=blue]
> if you have an idea what could be wrong in these headers,[/color]


How on Earth could I know or guess without seeing them?
[color=blue]
> that affects
> my templates, i would be happy to know.[/color]

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.

[color=blue]
>
> I'm using VS6 SP5 since the SP6 doesn't work with the "processor Pack"
> Update from M$.[/color]

I doubt that service pack version is the trouble.

-Mike


Closed Thread