關於【error: expected identifier before ‘,’ token】錯誤的檢查

在編譯項目時,發生瞭如下錯誤:

In file included from trunk/be/include/nodes/JoinedTable.h:11:0,
                 from trunk/be/include/nodes/SelectStmt.h:34,
                 from trunk/be/include/nodes/SubPlan.h:19,
                 from trunk/be/include/queryexecutor/iqueryexecutor.h:20,
                 from trunk/be/include/coord/RootCoordinator.h:14,
                 from trunk/be/include/sessionservice/query_exec_engine.h:9,
                 from  trunk/be/include/sessionservice/gmcommond_engine.h:28,
                 from  trunk/be/include/gmcommand/IGMCommandService.h:27,
                 from trunk/be/include/storagelimit/StorageLimitCmdService.h:31,
                 from trunk/be/src/storagelimit/StorageLimitCmdService.cpp:23:
trunk/be/include/nodes/filter.h:34:7: error: expected identifier before ‘,’ token
     IN,
       ^
In file included from trunk/be/include/nodes/JoinedTable.h:11:0,
                 from trunk/be/include/nodes/SelectStmt.h:34,
                 from trunk/be/include/nodes/SubPlan.h:19,
                 from trunk/be/include/queryexecutor/iqueryexecutor.h:20,
                 from trunk/be/include/coord/RootCoordinator.h:14,
                 from trunk/be/include/sessionservice/query_exec_engine.h:9,
                 from trunk/be/include/sessionservice/gmcommond_engine.h:28,
                 from trunk/be/include/gmcommand/IGMCommandService.h:27,
                 from trunk/be/include/storagelimit/StorageLimitCmdService.h:31,
                 from trunk/be/src/storagelimit/StorageLimitServiceBlock.cpp:10:
trunk/be/include/nodes/filter.h:34:7: error: expected identifier before ‘,’ token
     IN,
       ^

經過檢查文件,提示錯誤處僅僅是個枚舉:

enum OP {
    GT,
    GE,
    LT,
    LE,
    EQ,
    IN,
    NE,
    OP_NL
};

網上搜索從這個博客得知,有可能是因爲在包含此文件的源文件中已經IN這個定義了。於是使用

#ifdef IN
#undef IN
#endif

來解除IN的宏,之後編譯通過。


查找哪個地方存定義了IN,這裏費了很多周折,最後是將IN寫到源文件中:然後通過IDE的查找定義功能查找到,在Common-def.h和DataStreamReader.h中有如下定義:

//DataStreamReader.h

#define IN
#define OUT

//Common-def.h

#define IN
#define OUT

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章