473,326 Members | 2,127 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,326 software developers and data experts.

Having trouble with getting this to compile.

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
-----------------------------------
Nov 17 '05 #1
5 1287

"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
Nov 17 '05 #2
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

Nov 17 '05 #3
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


Nov 17 '05 #4
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



Nov 17 '05 #5
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
Nov 17 '05 #6

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

Similar topics

1
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i...
4
by: Jacek Dziedzic | last post by:
Hi! First of all, I hope my problem is not too loosely tied to the "standard C++" that is the topic of this group. I have some code that exhibits a strange behaviour: on one computer, where I...
1
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an...
7
by: JustSomeGuy | last post by:
I have two classes, class english and class metric. I seem to be having dificulty getting this to compile properly... I'm using powerpc-apple-darwin8-g++-4.0.0 There are 5 files, main.cpp...
9
by: Christian Blackburn | last post by:
Hi Gang, I don't know what to make of all of this, but I'm having nothing, but trouble copying data to the clipboard which should be the easiest thing in the world. The only systems I can get...
1
by: Jozef | last post by:
Hello. I'm having trouble creating a blank solution (and ASP.net web application) from my laptop. I own the server (in fact it's sitting right next to me) and have added the URL to the trusted...
2
by: Jake Barnes | last post by:
I've read over the documentation for these effects: http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo I want to include them on my page. I tried attaching using onload, but...
12
blazedaces
by: blazedaces | last post by:
Hello again. I'm trying to take as an input an ArrayList<String> and utilize String's .spit(delimiter) method to turn that into a String. I'm getting some kind of error though (I'll post the code...
1
by: ced69 | last post by:
having trouble getting marquee to work get object required errors tring t <title>This Month at the Chamberlain Civic Center</title> <link href="styles.css" rel="stylesheet"...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.