Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Enum Issue

Enum Issue

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VC_RYK
    wrote on last edited by
    #1

    Hi Experts I am migrating one project from Vc 6.0 to Vc 8.0. I found one compilation Error regarding Enum. In Vc 6.0 they have declared an enum in a class and again the same enum they are using in other class with scope resolution and have changed the enum value. It is compiling fine on Vc 6.0 but throwing an error while compiling in Vc 8.0. Example code. class CTest { public: enum TestEnum {NA=0, First}; }; class CTest1 { public: enum CTest::TestEnum {Second, Third}; }; It is working fine in Vc 6.0 but throwing error in Vc 8.0 Error is:- error C2911: 'CTest::TestEnum' : cannot be declared or defined in the current scope

    A 1 Reply Last reply
    0
    • V VC_RYK

      Hi Experts I am migrating one project from Vc 6.0 to Vc 8.0. I found one compilation Error regarding Enum. In Vc 6.0 they have declared an enum in a class and again the same enum they are using in other class with scope resolution and have changed the enum value. It is compiling fine on Vc 6.0 but throwing an error while compiling in Vc 8.0. Example code. class CTest { public: enum TestEnum {NA=0, First}; }; class CTest1 { public: enum CTest::TestEnum {Second, Third}; }; It is working fine in Vc 6.0 but throwing error in Vc 8.0 Error is:- error C2911: 'CTest::TestEnum' : cannot be declared or defined in the current scope

      A Offline
      A Offline
      Aescleal
      wrote on last edited by
      #2

      Listen to the compiler - the VC++ handling of enums changed significantly in either 2002 or 2003 - the code that compiled under VC++6 is just plain wrong, you can't open up enums and extend them the way you can namespaces. All Microsoft compilers have a breaking changes document, have a look in that to see what else has changed and going to trip you up. Ash

      V 1 Reply Last reply
      0
      • A Aescleal

        Listen to the compiler - the VC++ handling of enums changed significantly in either 2002 or 2003 - the code that compiled under VC++6 is just plain wrong, you can't open up enums and extend them the way you can namespaces. All Microsoft compilers have a breaking changes document, have a look in that to see what else has changed and going to trip you up. Ash

        V Offline
        V Offline
        VC_RYK
        wrote on last edited by
        #3

        Thanks Ash, I have searched through the entire MS site, went through the "Major Changes from Visual C++ 6.0 to Visual C++ .NET" document [http://msdn.microsoft.com/en-us/library/2byy0fh6%28v=VS.71%29.aspx[^]]. No info about this.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups