结构中出现意外的C函数指针定义语法错误

时间:2014-11-14 03:43:19

标签: c

当我将头文件包含在特定文件中时,GCC会报告这种奇怪的语法错误。

错误:

In file included from ../src/libscws/rule.h:17,
                 from ../src/libscws/scws.h:16,
                 from ../src/libscws/scws.c:20:
../src/libscws/../cjson/cJSON.h:58: error: expected ‘)’ before ‘sz’
../src/libscws/../cjson/cJSON.h:59: error: expected ‘;’ before ‘void’

cJSON.h:

enter image description here

包含来源:

  8 #ifndef _SCWS_RULE_20070525_H_
  9 #define _SCWS_RULE_20070525_H_
 10 
 11 
 12 #ifdef __cplusplus
 13 extern "C" {
 14 #endif
 15 
 16 /* xtree required */
 17 #include "../cjson/cJSON.h"
 18 #include "xtree.h"
 19 
 20 #define SCWS_RULE_MAX     32
 21 #define SCWS_RULE_SPECIAL   0x80000000
 22 #define SCWS_RULE_NOSTATS   0x40000000

1 个答案:

答案 0 :(得分:2)

可能未定义size_t。尝试在所有其他标题之前添加stddef.h