枚举声明时的错误

时间:2014-07-30 09:44:33

标签: c++ enums

class API {
public:

        //States that the API can be in.
        enum API_STATE {
    /* Line 35*/ INITIAL = 0, OPENED = 1, READY = 2, STOPPED = 3, OPENFORXFER = 4
        };

我在第35行遇到错误。如下。包括具有上述代码的头文件。

error: expected identifier before numeric constant
h:35: error: expected â}â before numeric constant
h:35: error: expected unqualified-id before numeric constant

1 个答案:

答案 0 :(得分:2)

您有一个宏定义INITIAL(或可能OPENED等)到数字文字:

#define INITIAL 0
enum API_STATE {
    INITIAL = 0, OPENED = 1, READY = 2, STOPPED = 3, OPENFORXFER = 4
};

Clang准确地给出了您报告的错误:

!!error: expected identifier before numeric constant
!!error: expected ‘}’ before numeric constant
!!error: expected unqualified-id before numeric constant
相关问题