-
Notifications
You must be signed in to change notification settings - Fork 306
Description
强制指定库选用本地库还是会一样的,解决此问题的原因应该是新版本的gcc编译器的错误检查更严格了
增加编译器-Wno- error选项能解决问题,最好还是采用老版本编译器
gcc ../cJSON/cJSON.c ../struct2json/src/.c ./.c -I ../cJSON/ -I ../struct2json/inc/ -lm -DDEBUGS2J -g -o tests2j
In file included from ./my_struct_2_json.c:2:
./my_struct_2_json.inc:30:40: warning: '/' within block comment [-Wcomment]
30 | gcc ../cJSON/cJSON.c ../struct2json/src/.c ./.c -I ../cJSON/ -I ../struct2json/inc/ -lm -DDEBUGS2J -g -o tests2j
| ^
./my_struct_2_json.inc:30:46: warning: '/' within block comment [-Wcomment]
30 | gcc ../cJSON/cJSON.c ../struct2json/src/.c ./.c -I ../cJSON/ -I ../struct2json/inc/ -lm -DDEBUGS2J -g -o tests2j
| ^
./my_struct_2_json.c:40:2: error: incompatible pointer to integer conversion passing 'int ' to parameter of type 'long long' [-Wint-conversion]
40 | s2j_json_set_array_element(json_obj_, struct_obj_, int, pIntArray,2);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2j.h:58:5: note: expanded from macro 's2j_json_set_array_element'
58 | S2J_JSON_SET_ARRAY_ELEMENT(to_json, from_struct, type, element, size)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:159:17: note: expanded from macro 'S2J_JSON_SET_ARRAY_ELEMENT'
159 | S2J_JSON_ARRAY_SET_ELEMENT(array_##_element, from_struct, type, element, index##element);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:140:5: note: expanded from macro 'S2J_JSON_ARRAY_SET_ELEMENT'
140 | S2J_JSON_ARRAY_SET##type##ELEMENT(to_json, from_struct, element, index)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:115:1: note: expanded from here
115 | S2J_JSON_ARRAY_SET_int_ELEMENT
| ^
./../struct2json/inc/s2jdef.h:130:51: note: expanded from macro 'S2J_JSON_ARRAY_SET_int_ELEMENT'
130 | cJSON_AddItemToArray(to_json, cJSON_CreateInt((from_struct)->element[index]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../cJSON/cJSON.h:201:49: note: passing argument to parameter 'integer' here
201 | CJSON_PUBLIC(cJSON ) cJSON_CreateInt(long long integer);
| ^
./my_struct_2_json.c:42:2: error: incompatible pointer to integer conversion passing 'fun_ptr_CbT' (aka 'int ()(int, int)') to parameter of type 'long long' [-Wint-conversion]
42 | s2j_json_set_array_element(json_obj, struct_obj, int, funArray,2);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2j.h:58:5: note: expanded from macro 's2j_json_set_array_element'
58 | S2J_JSON_SET_ARRAY_ELEMENT(to_json, from_struct, type, element, size)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:159:17: note: expanded from macro 'S2J_JSON_SET_ARRAY_ELEMENT'
159 | S2J_JSON_ARRAY_SET_ELEMENT(array##_element, from_struct, type, element, index##element);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:140:5: note: expanded from macro 'S2J_JSON_ARRAY_SET_ELEMENT'
140 | S2J_JSON_ARRAY_SET##type##_ELEMENT(to_json, from_struct, element, index)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:130:1: note: expanded from here
130 | S2J_JSON_ARRAY_SET_int_ELEMENT
| ^
./../struct2json/inc/s2jdef.h:130:51: note: expanded from macro 'S2J_JSON_ARRAY_SET_int_ELEMENT'
130 | cJSON_AddItemToArray(to_json, cJSON_CreateInt((from_struct)->element[index]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../cJSON/cJSON.h:201:49: note: passing argument to parameter 'integer' here
201 | CJSON_PUBLIC(cJSON *) cJSON_CreateInt(long long integer);
| ^
./my_struct_2_json.c:65:2: error: incompatible integer to pointer conversion assigning to 'int *' from 'long long' [-Wint-conversion]
65 | s2j_struct_get_basic_element(struct_obj,json_obj, int, pInt);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2j.h:74:5: note: expanded from macro 's2j_struct_get_basic_element'
74 | S2J_STRUCT_GET_BASIC_ELEMENT(to_struct, from_json, type, element)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:179:5: note: expanded from macro 'S2J_STRUCT_GET_BASIC_ELEMENT'
179 | S2J_STRUCT_GET##type##_ELEMENT(to_struct, from_json, element)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:43:1: note: expanded from here
43 | S2J_STRUCT_GET_int_ELEMENT
| ^
./../struct2json/inc/s2jdef.h:49:42: note: expanded from macro 'S2J_STRUCT_GET_int_ELEMENT'
49 | if (json_temp) (to_struct)->element = json_temp->valueint;
| ^ ~~~~~~~~~~~~~~~~~~~
./my_struct_2_json.c:66:2: error: incompatible integer to pointer conversion assigning to 'int *' from 'long long' [-Wint-conversion]
66 | s2j_struct_get_array_element(struct_obj,json_obj, int, pIntArray);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2j.h:81:5: note: expanded from macro 's2j_struct_get_array_element'
81 | S2J_STRUCT_GET_ARRAY_ELEMENT(to_struct, from_json, type, element)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:195:21: note: expanded from macro 'S2J_STRUCT_GET_ARRAY_ELEMENT'
195 | S2J_STRUCT_ARRAY_GET_ELEMENT(to_struct, array_item##_element, type, element, index##element);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:102:5: note: expanded from macro 'S2J_STRUCT_ARRAY_GET_ELEMENT'
102 | S2J_STRUCT_ARRAY_GET##type##_ELEMENT(to_struct, from_json, _element, index)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:68:1: note: expanded from here
68 | S2J_STRUCT_ARRAY_GET_int_ELEMENT
| ^
./../struct2json/inc/s2jdef.h:93:34: note: expanded from macro 'S2J_STRUCT_ARRAY_GET_int_ELEMENT'
93 | (to_struct)->_element[index] = from_json->valueint;
| ^ ~~~~~~~~~~~~~~~~~~~
./my_struct_2_json.c:67:2: error: incompatible integer to pointer conversion assigning to 'fun_ptr_CbT' (aka 'int ()(int, int)') from 'long long' [-Wint-conversion]
67 | s2j_struct_get_basic_element(struct_obj_,json_obj, int, fun);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2j.h:74:5: note: expanded from macro 's2j_struct_get_basic_element'
74 | S2J_STRUCT_GET_BASIC_ELEMENT(to_struct, from_json, type, element)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:179:5: note: expanded from macro 'S2J_STRUCT_GET_BASIC_ELEMENT'
179 | S2J_STRUCT_GET_##type##_ELEMENT(to_struct, from_json, element)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:70:1: note: expanded from here
70 | S2J_STRUCT_GET_int_ELEMENT
| ^
./../struct2json/inc/s2jdef.h:49:42: note: expanded from macro 'S2J_STRUCT_GET_int_ELEMENT'
49 | if (json_temp) (to_struct)->element = json_temp->valueint;
| ^ ~~~~~~~~~~~~~~~~~~~
./my_struct_2_json.c:68:2: error: incompatible integer to pointer conversion assigning to 'fun_ptr_CbT' (aka 'int (*)(int, int)') from 'long long' [-Wint-conversion]
68 | s2j_struct_get_array_element(struct_obj,json_obj, int, funArray);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2j.h:81:5: note: expanded from macro 's2j_struct_get_array_element'
81 | S2J_STRUCT_GET_ARRAY_ELEMENT(to_struct, from_json, type, element)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:195:21: note: expanded from macro 'S2J_STRUCT_GET_ARRAY_ELEMENT'
195 | S2J_STRUCT_ARRAY_GET_ELEMENT(to_struct, array_item##_element, type, element, index##element);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:102:5: note: expanded from macro 'S2J_STRUCT_ARRAY_GET_ELEMENT'
102 | S2J_STRUCT_ARRAY_GET##type##_ELEMENT(to_struct, from_json, element, index)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:95:1: note: expanded from here
95 | S2J_STRUCT_ARRAY_GET_int_ELEMENT
| ^
./../struct2json/inc/s2jdef.h:93:34: note: expanded from macro 'S2J_STRUCT_ARRAY_GET_int_ELEMENT'
93 | (to_struct)->element[index] = from_json->valueint;
| ^ ~~~~~~~~~~~~~~~~~~~
./my_struct_2_json.c:159:2: error: incompatible integer to pointer conversion assigning to 'void *' from 'long long' [-Wint-conversion]
159 | s2j_struct_get_basic_element(struct_obj,json_obj, int, pUsrDef);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2j.h:74:5: note: expanded from macro 's2j_struct_get_basic_element'
74 | S2J_STRUCT_GET_BASIC_ELEMENT(to_struct, from_json, type, element)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../struct2json/inc/s2jdef.h:179:5: note: expanded from macro 'S2J_STRUCT_GET_BASIC_ELEMENT'
179 | S2J_STRUCT_GET##type##_ELEMENT(to_struct, from_json, _element)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:36:1: note: expanded from here
36 | S2J_STRUCT_GET_int_ELEMENT
| ^
./../struct2json/inc/s2jdef.h:49:42: note: expanded from macro 'S2J_STRUCT_GET_int_ELEMENT'
49 | if (json_temp) (to_struct)->_element = json_temp->valueint;
| ^ ~~~~~~~~~~~~~~~~~~~
2 warnings and 7 errors generated.