GCC says “syntax error before numeric constant” in generated header file from bison

后端 未结 2 1782
Happy的楠姐
Happy的楠姐 2021-01-04 12:19

When I compile my .y file with bison parser.y -d -t and then include the parser.tab.h file in my flex file, gcc says \"error: syntax error before numeric constant.\" It\'s r

2条回答
  •  一生所求
    2021-01-04 12:52

    Is BREAK defined somewhere else in your code? I get a similar error from the following toy example:

    #define BREAK 10
    enum yytokentype {
        BREAK = 258
    };
    

    Build example:

    $ cc -c file.c 
    file.c:4: error: expected identifier before numeric constant
    

提交回复
热议问题