The following code snippet will not compile. I get an error C2337 saying
that the flags attribute is not found, however, if I remove the last
namespace System from the namespace tree, then it compiles fine. What
gives?
#pragma once
using namespace System;
namespace TestA
{
namespace TestB
{
namespace System
{
[Flags]
public __value enum SchedDayType
{
SPECIAL=0,
MON=1,
TUE=2,
WED=4,
THU=8,
FRI=16,
SAT=32,
SUN=64,
WEEKDAY=MON|TUE|WED|THU|FRI,
WEEKEND=SAT|SUN,
EVERYDAY=WEEKDAY|WEEKEND
};
}
}
}
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
----------------------------------- 5 1213
"Ken Varn" <nospam> wrote in message
news:eD**************@TK2MSFTNGP14.phx.gbl... The following code snippet will not compile. I get an error C2337 saying that the flags attribute is not found, however, if I remove the last namespace System from the namespace tree, then it compiles fine. What gives?
#pragma once
using namespace System;
namespace TestA { namespace TestB { namespace System { [Flags] public __value enum SchedDayType { SPECIAL=0, MON=1, TUE=2, WED=4, THU=8, FRI=16, SAT=32, SUN=64, WEEKDAY=MON|TUE|WED|THU|FRI, WEEKEND=SAT|SUN, EVERYDAY=WEEKDAY|WEEKEND }; } } }
I believe this is due to compiler's namespaces collision.
Try to write [FlagsAttribute], [System::FlagsAttribute], or even
[::System::FlagsAttribute].
--
Vladimir Nesterovsky
e-mail: vl******@nesterovsky-bros.com
home: www.nesterovsky-bros.com
Tried all three. None of them seem to work. Technically, the enum should
belong to namespace TestA.TestB.System. Why would there be a collision with
the base CLR System namespace?
Any other suggestions?
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Vladimir Nesterovsky" <vl******@nesterovsky-bros.com> wrote in message
news:ei**************@TK2MSFTNGP10.phx.gbl... "Ken Varn" <nospam> wrote in message news:eD**************@TK2MSFTNGP14.phx.gbl... The following code snippet will not compile. I get an error C2337
saying that the flags attribute is not found, however, if I remove the last namespace System from the namespace tree, then it compiles fine. What gives?
#pragma once
using namespace System;
namespace TestA { namespace TestB { namespace System { [Flags] public __value enum SchedDayType { SPECIAL=0, MON=1, TUE=2, WED=4, THU=8, FRI=16, SAT=32, SUN=64, WEEKDAY=MON|TUE|WED|THU|FRI, WEEKEND=SAT|SUN, EVERYDAY=WEEKDAY|WEEKEND }; } } }
I believe this is due to compiler's namespaces collision. Try to write [FlagsAttribute], [System::FlagsAttribute], or even [::System::FlagsAttribute]. -- Vladimir Nesterovsky e-mail: vl******@nesterovsky-bros.com home: www.nesterovsky-bros.com
Possibly the 'using namespace System' is causing the confusion - [Flags]
could reasonably be interpreted as System.Flags.
Steve
"Ken Varn" <nospam> wrote in message
news:Oz**************@TK2MSFTNGP15.phx.gbl... Tried all three. None of them seem to work. Technically, the enum should belong to namespace TestA.TestB.System. Why would there be a collision with the base CLR System namespace?
Any other suggestions?
-- ----------------------------------- Ken Varn Senior Software Engineer Diebold Inc.
EmailID = varnk Domain = Diebold.com ----------------------------------- "Vladimir Nesterovsky" <vl******@nesterovsky-bros.com> wrote in message news:ei**************@TK2MSFTNGP10.phx.gbl... "Ken Varn" <nospam> wrote in message news:eD**************@TK2MSFTNGP14.phx.gbl... > The following code snippet will not compile. I get an error C2337 saying > that the flags attribute is not found, however, if I remove the last > namespace System from the namespace tree, then it compiles fine. What > gives? > > #pragma once > > using namespace System; > > namespace TestA > { > namespace TestB > { > namespace System > { > [Flags] > public __value enum SchedDayType > { > SPECIAL=0, > MON=1, > TUE=2, > WED=4, > THU=8, > FRI=16, > SAT=32, > SUN=64, > WEEKDAY=MON|TUE|WED|THU|FRI, > WEEKEND=SAT|SUN, > EVERYDAY=WEEKDAY|WEEKEND > }; > } > } > }
I believe this is due to compiler's namespaces collision. Try to write [FlagsAttribute], [System::FlagsAttribute], or even [::System::FlagsAttribute]. -- Vladimir Nesterovsky e-mail: vl******@nesterovsky-bros.com home: www.nesterovsky-bros.com
That's my guess as well, is there anyway around this or am I forced to
change the namespace naming scheme?
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl... Possibly the 'using namespace System' is causing the confusion - [Flags] could reasonably be interpreted as System.Flags.
Steve
"Ken Varn" <nospam> wrote in message news:Oz**************@TK2MSFTNGP15.phx.gbl... Tried all three. None of them seem to work. Technically, the enum
should belong to namespace TestA.TestB.System. Why would there be a collision with the base CLR System namespace?
Any other suggestions?
-- ----------------------------------- Ken Varn Senior Software Engineer Diebold Inc.
EmailID = varnk Domain = Diebold.com ----------------------------------- "Vladimir Nesterovsky" <vl******@nesterovsky-bros.com> wrote in message news:ei**************@TK2MSFTNGP10.phx.gbl... "Ken Varn" <nospam> wrote in message news:eD**************@TK2MSFTNGP14.phx.gbl... > The following code snippet will not compile. I get an error C2337
saying > that the flags attribute is not found, however, if I remove the last > namespace System from the namespace tree, then it compiles fine.
What > gives? > > #pragma once > > using namespace System; > > namespace TestA > { > namespace TestB > { > namespace System > { > [Flags] > public __value enum SchedDayType > { > SPECIAL=0, > MON=1, > TUE=2, > WED=4, > THU=8, > FRI=16, > SAT=32, > SUN=64, > WEEKDAY=MON|TUE|WED|THU|FRI, > WEEKEND=SAT|SUN, > EVERYDAY=WEEKDAY|WEEKEND > }; > } > } > }
I believe this is due to compiler's namespaces collision. Try to write [FlagsAttribute], [System::FlagsAttribute], or even [::System::FlagsAttribute]. -- Vladimir Nesterovsky e-mail: vl******@nesterovsky-bros.com home: www.nesterovsky-bros.com
Hi Ken, That's my guess as well, is there anyway around this or am I forced to change the namespace naming scheme?
To tell you the truth, I wasn't able to get it to work even using namespace
aliases, which is bad (seems like the compiler treats it in a fairly special
way).
But even if you could get it to compile, the naming scheme would just cause
too much trouble later on (way too much stuff that could clash).... you'd be
better off just changing it and avoiding a namespace called System.
--
Tomas Restrepo to****@mvps.org This discussion thread is closed Replies have been disabled for this discussion. Similar topics
1 post
views
Thread by Anand |
last post: by
|
4 posts
views
Thread by Jacek Dziedzic |
last post: by
|
1 post
views
Thread by malcolm |
last post: by
|
7 posts
views
Thread by JustSomeGuy |
last post: by
|
9 posts
views
Thread by Christian Blackburn |
last post: by
|
1 post
views
Thread by Jozef |
last post: by
|
2 posts
views
Thread by Jake Barnes |
last post: by
| | | | | | | | | | | | |