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
答案 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