0

GCC reports this weird syntax error when I include the header file in a specific file.

Error:

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

Include source:

  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
2
  • 2
    It may be that size_t is not defined. Try including stddef.h before all your other headers. Commented Nov 14, 2014 at 4:02
  • @JS1 wow, works like charm. Thanks! Still can't understand why GCC complains syntax error rather than size_t is not defined. You can write an answer so I can resolve the question Commented Nov 14, 2014 at 4:15

1 Answer 1

2

It may be that size_t is not defined. Try including stddef.h before all your other headers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.