+ Reply to Thread
Results 1 to 2 of 2

What does "expected unqualified-id before numeric constant" mean?

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    0

    Default What does "expected unqualified-id before numeric constant" mean?

    In my app, there is a namespace definition.

    ....
    namespace CMD {
    ...
    const int YT_UP = 1; // line 149
    ...
    };

    g++ tells expected unqualified-id before numeric constant error at
    line 149.
    I change it to be

    namespace CMD {
    ...
    const int YT_UP1 = 1; // line 149
    ...
    };

    It compiles ok.

    So is there name collision for YT_UP?

  2. #2
    Junior Member
    Join Date
    Nov 2009
    Posts
    0

    Default Re: What does "expected unqualified-id before numeric constant" mean?

    Allen wrote:
    :: In my app, there is a namespace definition.
    ::
    :: ...
    :: namespace CMD {
    :: ...
    :: const int YT_UP = 1; // line 149
    :: ...
    :: };
    ::
    :: g++ tells expected unqualified-id before numeric constant error at
    :: line 149.
    :: I change it to be
    ::
    :: namespace CMD {
    :: ...
    :: const int YT_UP1 = 1; // line 149
    :: ...
    :: };
    ::
    :: It compiles ok.
    ::
    :: So is there name collision for YT_UP?

    Probably.

    All uppercase names are often used for preprocessor macros, which
    doesn't respect namespace scopes. Therefore such names should
    generally be avoided for everything else.



    Bo Persson



+ Reply to Thread