locked
What does "error C4452" means?

    Question

  • I am getting the "error C4452" Error Message when I building a Win8 Project using vs2012, but I can't find any description about Error C4452 on MSDN.

    Could you please tell me what does this mean?

    Saturday, August 31, 2013 12:33 AM

Answers

  • Hi EriSeven ,

    Welcome to MSDN forum!

    As Chuck says, if you want to get more correct solution, please share more info with us.

    And i found a result of C4452:

    Public types at global (file) scope are no longer permitted

    Brief description

    Allowing public types at global scope resulted in the compiler generated metadata (winmd) which violated the Windows Runtime specification.  Additionally, these types were not loadable by JavaScript and CLR clients.

    Languages

    C++

    Issue and Details

    The compiler will now issue the following error when it detects public types at global scope:

    //at global scope

    public ref class R sealed {};

    error C4452: 'R' : public type cannot be at global scope. It must be in a namespace that is a child of the name of the output .winmd file.

    Samples usage or steps to take to migrate code

    The type must be placed in an appropriate namespace, or it must be made non-public.
    (In extreme cases, this error can be disabled, but this should never be done in user-facing code.)


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, September 02, 2013 8:17 AM
    Moderator

All replies

  • What is the full text of the error message?

    Saturday, August 31, 2013 6:07 AM
  • Hi EriSeven ,

    Welcome to MSDN forum!

    As Chuck says, if you want to get more correct solution, please share more info with us.

    And i found a result of C4452:

    Public types at global (file) scope are no longer permitted

    Brief description

    Allowing public types at global scope resulted in the compiler generated metadata (winmd) which violated the Windows Runtime specification.  Additionally, these types were not loadable by JavaScript and CLR clients.

    Languages

    C++

    Issue and Details

    The compiler will now issue the following error when it detects public types at global scope:

    //at global scope

    public ref class R sealed {};

    error C4452: 'R' : public type cannot be at global scope. It must be in a namespace that is a child of the name of the output .winmd file.

    Samples usage or steps to take to migrate code

    The type must be placed in an appropriate namespace, or it must be made non-public.
    (In extreme cases, this error can be disabled, but this should never be done in user-facing code.)


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, September 02, 2013 8:17 AM
    Moderator