Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2004

Tip: Looking for answers? Try searching our database.

Having trouble with getting this to compile.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Varn - 11 Nov 2004 14:34 GMT
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
        };
     }
  }
}

Signature

-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Vladimir Nesterovsky - 11 Nov 2004 15:04 GMT
> 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
[quoted text clipped - 29 lines]
>    }
> }

I believe this is due to compiler's namespaces collision.
Try to write [FlagsAttribute], [System::FlagsAttribute], or even
[::System::FlagsAttribute].
Signature

Vladimir Nesterovsky
e-mail: vladimir@nesterovsky-bros.com
home: www.nesterovsky-bros.com

Ken Varn - 12 Nov 2004 13:44 GMT
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?

Signature

-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

>
> > The following code snippet will not compile.  I get an error C2337 saying
[quoted text clipped - 34 lines]
> Try to write [FlagsAttribute], [System::FlagsAttribute], or even
> [::System::FlagsAttribute].
Steve McLellan - 12 Nov 2004 14:35 GMT
Possibly the 'using namespace System' is causing the confusion - [Flags]
could reasonably be interpreted as System.Flags.

Steve

> 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
[quoted text clipped - 41 lines]
>> Try to write [FlagsAttribute], [System::FlagsAttribute], or even
>> [::System::FlagsAttribute].
Ken Varn - 12 Nov 2004 18:05 GMT
That's my guess as well, is there anyway around this or am I forced to
change the namespace naming scheme?

Signature

-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

> Possibly the 'using namespace System' is causing the confusion - [Flags]
> could reasonably be interpreted as System.Flags.
[quoted text clipped - 46 lines]
> >> Try to write [FlagsAttribute], [System::FlagsAttribute], or even
> >> [::System::FlagsAttribute].
Tomas Restrepo \(MVP\) - 13 Nov 2004 03:38 GMT
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.

Signature

Tomas Restrepo
tomasr@mvps.org


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.