C语言编译 gcc -c my_struct.c 报错:my_struct.c:3:1: 错误:expected ‘;’, identifier or ‘(’ before ‘int’ int mai

本文分析了使用GCC编译C语言程序时遇到的一个常见错误:忘记在结构体定义末尾添加分号导致的编译失败。通过具体的例子,详细解释了如何定位问题并修复。

C语言编译 gcc -c my_struct.c 报错:my_struct.c:3:1: 错误:expected ‘;’, identifier or ‘(’ before ‘int’ int mai

原因:是因为我在头文件订单struct student {}的时候忘记在最后加;分号了

arp_final.c:16:0: warning: "IFNAMSIZ" redefined #define IFNAMSIZ 16 ^ In file included from arp_final.c:7:0: /usr/include/net/if.h:129:0: note: this is the location of the previous definition # define IFNAMSIZ IF_NAMESIZE ^ arp_final.c:68:8: error: redefinition of ‘struct ifreq’ struct ifreq { ^ In file included from arp_final.c:7:0: /usr/include/net/if.h:126:8: note: originally defined here struct ifreq ^ arp_final.c:69:10: error: expected:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before.’ token char ifr_name[IFNAMSIZ]; ^ arp_final.c: In function ‘if_nametoindex’: arp_final.c:125:16: error:struct ifreq’ has no member named ‘ifr_ifrn’ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1); ^ arp_final.c:134:15: error:struct ifreq’ has no member named ‘ifr_ifru’ return ifr.ifr_ifru.ifru_metric; ^ arp_final.c: In function ‘get_local_mac’: arp_final.c:146:16: error:struct ifreq’ has no member named ‘ifr_ifrn’ strncpy(ifr.ifr_name, ifname, IFNAMSIZ); ^ arp_final.c:153:20: error:struct ifreq’ has no member named ‘ifr_ifru’ memcpy(mac, ifr.ifr_ifru.ifru_hwaddr.sa_data, MAC_LENGTH); ^ arp_final.c: In function ‘get_local_ip’: arp_final.c:166:16: error:struct ifreq’ has no member named ‘ifr_ifrn’ strncpy(ifr.ifr_name, ifname, IFNAMSIZ); ^ arp_final.c:173:57: error:struct ifreq’ has no member named ‘ifr_ifru’ struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_ifru.ifru_addr; ^ arp_final.c: In function ‘build_arp_packet’: arp_final.c:191:25: error: ‘ETH_P_IP’ undeclared (first use in this function) arp->ar_pro = htons(ETH_P_IP); ^ arp_final.c:191:25: note: each undeclared identifier is reported only once for each function it appears in arp_final.c: In function ‘send_arp’: arp_final.c:230:12: error: variable ‘dest’ has initializer but incomplete type struct sockaddr_ll dest = { ^ arp_final.c:231:9: error: unknown field ‘sll_family’ specified in initializer .sll_family = AF_PACKET, ^ arp_final.c:232:9: error: unknown field ‘sll_protocol’ specified in initializer .sll_protocol = htons(ETH_P_ARP), ^ arp_final.c:232:25: warning: excess elements in struct initializer .sll_protocol = htons(ETH_P_ARP), ^ arp_final.c:232:25: note: (near initialization for ‘dest’) arp_final.c:233:9: error: unknown field ‘sll_ifindex’ specified in initializer .sll_ifindex = if_nametoindex(ifname), ^ arp_final.c:233:24: warning: excess elements in struct initializer .sll_ifindex = if_nametoindex(ifname), ^ arp_final.c:233:24: note: (near initialization for ‘dest’) arp_final.c:234:9: error: unknown field ‘sll_halen’ specified in initializer .sll_halen = ETH_ALEN, ^ arp_final.c:24:18: warning: excess elements in struct initializer #define ETH_ALEN 6 ^ arp_final.c:234:22: note: in expansion of macro ‘ETH_ALEN’ .sll_halen = ETH_ALEN, ^ arp_final.c:24:18: note: (near initialization for ‘dest’) #define ETH_ALEN 6 ^ arp_final.c:234:22: note: in expansion of macro ‘ETH_ALEN’ .sll_halen = ETH_ALEN, ^ arp_final.c:235:9: error: unknown field ‘sll_addr’ specified in initializer .sll_addr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} // 广播地址 ^ arp_final.c:235:21: error: extra brace group at end of initializer .sll_addr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} // 广播地址 ^ arp_final.c:235:21: note: (near initialization for ‘dest’) arp_final.c:235:21: warning: excess elements in struct initializer arp_final.c:235:21: note: (near initialization for ‘dest’) arp_final.c:230:24: error: storage size of ‘dest’ isn’t known struct sockaddr_ll dest = { ^ arp_final.c: In function ‘find_or_create_node’: arp_final.c:275:5: warning: implicit declaration of function ‘list_for_each’ [-Wimplicit-function-declaration] list_for_each(pos, &arp_result_head) { ^ arp_final.c:275:42: error: expected ‘;’ before ‘{’ token list_for_each(pos, &arp_result_head) { ^ arp_final.c: In function ‘cleanup_thread’: arp_final.c:373:9: warning: implicit declaration of function ‘list_for_each_safe’ [-Wimplicit-function-declaration] list_for_each_safe(pos, next, &arp_result_head) { ^ arp_final.c:373:57: error: expected ‘;’ before ‘{’ token list_for_each_safe(pos, next, &arp_result_head) { ^ arp_final.c: In function ‘print_arp_table’: arp_final.c:403:42: error: expected ‘;’ before ‘{’ token list_for_each(pos, &arp_result_head) { 报错如上
08-28
make "make -C modules/arp_scanner MODULE_NAME=arp_scanner" make[4]: Entering directory &#39;/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/arp_scanner&#39; arm-ca9-linux-uclibcgnueabihf-gcc -O2 -pipe -fgnu89-inline -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -ftree-vectorize -fno-builtin -fno-common -g -Wno-stringop-truncation -Wno-format-truncation -Wno-sizeof-pointer-div -Wno-stringop-overflow -Wno-format-overflow -Wno-sizeof-pointer-memaccess -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -DCONFIG_STATISTIC_REPORT_DOMAIN=n-da.tplinkcloud.com.cn -Wno-sizeof-pointer-div -Wno-restrict -Wno-format-truncation -Wno-format-overflow -Wno-stringop-truncation -DSUPPORT_PLUGIN -DCONFIG_MSG_PUSH_POST_URL=/surveillance/v1/reportMsg -DCONFIG_NTP_HOSTNAME=n-tss.tplinkcloud.com.cn -DUP_FIRMWARE_LIMIT_SIZE=16777216 -DSENSITIVITY_INT -DMAKEROOM_BEFORE_UPGRADE -DAUDIO_ENABLE -DCONFIG_TP_TAPO_MAP_ROOTFS -DTP_VIGI -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/include -I/home/fuyu1/code/Platform_NVMP/nvmp/../sdk/soc/nvt9856x/uclibc-toolchain-1.0.32/arm-ca9-linux-uclibcgnueabihf-8.4.01/arm-ca9-linux-uclibcgnueabihf/sysroot/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"tdpd tmpd mactool nifc ipcd dhcpc diagnose httpd tpntp system upgrade arp_scanner\"" -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/include -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common/ds -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/mactool -I./libXml -I./libutils -I./libmediautil -I../../include -c -o arp_scan.o arp_scan.c In file included from arp_scan.c:13: arp_scan.h:60:6: error: expected &#39;;&#39; before &#39;int&#39; LOCAL int arp_scan_init(); ^~~~ ; arp_scan.h:61:6: error: expected &#39;;&#39; before &#39;int&#39; LOCAL int arp_scan_check(); ^~~~ ; arp_scan.h:62:6: error: expected &#39;;&#39; before &#39;int&#39; LOCAL int arp_scan_start(); ^~~~ ; arp_scan.h:63:6: error: expected &#39;;&#39; before &#39;int&#39; LOCAL int arp_scan_reload(DS_MSG *msg); ^~~~ ; arp_scan.h:63:27: error: unknown type name &#39;DS_MSG&#39; LOCAL int arp_scan_reload(DS_MSG *msg); ^~~~~~ arp_scan.h:64:6: error: expected &#39;;&#39; before &#39;void&#39; LOCAL void arp_scan_main(); ^~~~~ ; arp_scan.c: In function &#39;arp_scan&#39;: arp_scan.h:21:24: error: expected expression before &#39;{&#39; token #define BROADCAST_ADDR {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} ^ arp_scan.c:118:45: note: in expansion of macro &#39;BROADCAST_ADDR&#39; memcpy(eth_header->ether_dhost, BROADCAST_ADDR, ETH_ALEN); ^~~~~~~~~~~~~~ arp_scan.c:118:13: error: too few arguments to function &#39;memcpy&#39; memcpy(eth_header->ether_dhost, BROADCAST_ADDR, ETH_ALEN); ^~~~~~ In file included from arp_scan.c:3: /home/fuyu1/code/Platform_NVMP/sdk/soc/nvt9856x/uclibc-toolchain-1.0.32/arm-ca9-linux-uclibcgnueabihf-8.4.01/arm-ca9-linux-uclibcgnueabihf/sysroot/usr/include/string.h:37:14: note: declared here extern void *memcpy (void *__restrict __dest, ^~~~~~ arp_scan.c: At top level: arp_scan.c:138:11: error: static declaration of &#39;arp_scan_init&#39; follows non-static declaration LOCAL int arp_scan_init() ^~~~~~~~~~~~~ In file included from arp_scan.c:13: arp_scan.h:60:11: note: previous declaration of &#39;arp_scan_init&#39; was here LOCAL int arp_scan_init(); ^~~~~~~~~~~~~ arp_scan.c: In function &#39;arp_scan_init&#39;: arp_scan.c:140:14: error: implicit declaration of function &#39;ds_read&#39;; did you mean &#39;pread&#39;? [-Werror=implicit-function-declaration] if (0 == ds_read(ARP_DATA_PATH, &arp_config_t, sizeof(arp_config_t))) ^~~~~~~ pread arp_scan.c:140:22: error: &#39;ARP_DATA_PATH&#39; undeclared (first use in this function) if (0 == ds_read(ARP_DATA_PATH, &arp_config_t, sizeof(arp_config_t))) ^~~~~~~~~~~~~ arp_scan.c:140:22: note: each undeclared identifier is reported only once for each function it appears in arp_scan.c:140:38: error: expected expression before &#39;arp_config_t&#39; if (0 == ds_read(ARP_DATA_PATH, &arp_config_t, sizeof(arp_config_t))) ^~~~~~~~~~~~ arp_scan.c:142:16: error: &#39;SLP_ESYSTEM&#39; undeclared (first use in this function) return SLP_ESYSTEM; ^~~~~~~~~~~ arp_scan.c:146:10: error: &#39;sockfd&#39; undeclared (first use in this function); did you mean &#39;socket&#39;? if ((sockfd = socket(AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, htons(ETH_P_ARP))) < 0) ^~~~~~ socket arp_scan.c:149:16: error: &#39;ERROR&#39; undeclared (first use in this function); did you mean &#39;SO_ERROR&#39;? return ERROR; ^~~~~ SO_ERROR arp_scan.c:153:5: error: unknown type name &#39;U8&#39; U8 table_len = arp_config_t.end_ip[3] - arp_config_t.start_ip[3] + 1; ^~ arp_scan.c:153:20: error: expected expression before &#39;arp_config_t&#39; U8 table_len = arp_config_t.end_ip[3] - arp_config_t.start_ip[3] + 1; ^~~~~~~~~~~~ arp_scan.c:154:5: error: &#39;ip_mac_table&#39; undeclared (first use in this function) ip_mac_table = (ARP_IPMAC_TABLE *)malloc(sizeof(ARP_IPMAC_TABLE) * table_len); ^~~~~~~~~~~~ arp_scan.c:154:21: error: &#39;ARP_IPMAC_TABLE&#39; undeclared (first use in this function) ip_mac_table = (ARP_IPMAC_TABLE *)malloc(sizeof(ARP_IPMAC_TABLE) * table_len); ^~~~~~~~~~~~~~~ arp_scan.c:154:38: error: expected expression before &#39;)&#39; token ip_mac_table = (ARP_IPMAC_TABLE *)malloc(sizeof(ARP_IPMAC_TABLE) * table_len); ^ arp_scan.c:156:5: error: implicit declaration of function &#39;gettimeofday&#39; [-Werror=implicit-function-declaration] gettimeofday(&cur_time, NULL); ^~~~~~~~~~~~ arp_scan.c:163:5: error: implicit declaration of function &#39;msg_attach_handler&#39; [-Werror=implicit-function-declaration] msg_attach_handler(MSGID_DMS_CMD, arp_call_handle); ^~~~~~~~~~~~~~~~~~ arp_scan.c:163:24: error: &#39;MSGID_DMS_CMD&#39; undeclared (first use in this function) msg_attach_handler(MSGID_DMS_CMD, arp_call_handle); ^~~~~~~~~~~~~ arp_scan.c:163:39: error: &#39;arp_call_handle&#39; undeclared (first use in this function) msg_attach_handler(MSGID_DMS_CMD, arp_call_handle); ^~~~~~~~~~~~~~~ arp_scan.c:165:12: error: &#39;OK&#39; undeclared (first use in this function) return OK; ^~ arp_scan.c: At top level: arp_scan.c:168:11: error: static declaration of &#39;arp_scan_check&#39; follows non-static declaration LOCAL int arp_scan_check() ^~~~~~~~~~~~~~ In file included from arp_scan.c:13: arp_scan.h:61:11: note: previous declaration of &#39;arp_scan_check&#39; was here LOCAL int arp_scan_check(); ^~~~~~~~~~~~~~ arp_scan.c: In function &#39;arp_scan_check&#39;: arp_scan.c:170:9: error: expected expression before &#39;arp_config_t&#39; if (arp_config_t.end_ip[2] != sender_ip[2] || arp_config_t.start_ip[2] != sender_ip[2] || ^~~~~~~~~~~~ arp_scan.c:173:9: error: implicit declaration of function &#39;ARP_DEBUG&#39;; did you mean &#39;SO_DEBUG&#39;? [-Werror=implicit-function-declaration] ARP_DEBUG("Invalid IP address range, please check.\n"); ^~~~~~~~~ SO_DEBUG arp_scan.c:174:16: error: &#39;ERROR&#39; undeclared (first use in this function); did you mean &#39;SO_ERROR&#39;? return ERROR; ^~~~~ SO_ERROR arp_scan.c:176:12: error: &#39;OK&#39; undeclared (first use in this function) return OK; ^~ arp_scan.c: At top level: arp_scan.c:179:11: error: static declaration of &#39;arp_scan_start&#39; follows non-static declaration LOCAL int arp_scan_start() ^~~~~~~~~~~~~~ In file included from arp_scan.c:13: arp_scan.h:62:11: note: previous declaration of &#39;arp_scan_start&#39; was here LOCAL int arp_scan_start(); ^~~~~~~~~~~~~~ arp_scan.c: In function &#39;arp_scan_start&#39;: arp_scan.c:182:21: error: &#39;time_tid&#39; undeclared (first use in this function); did you mean &#39;time_t&#39;? pthread_create(&time_tid, NULL, check_table_renew_time, NULL); ^~~~~~~~ time_t arp_scan.c:182:37: error: &#39;check_table_renew_time&#39; undeclared (first use in this function) pthread_create(&time_tid, NULL, check_table_renew_time, NULL); ^~~~~~~~~~~~~~~~~~~~~~ arp_scan.c:186:12: error: &#39;scanning_flag&#39; undeclared (first use in this function) while (scanning_flag) ^~~~~~~~~~~~~ arp_scan.c:188:9: error: implicit declaration of function &#39;scan_once&#39; [-Werror=implicit-function-declaration] scan_once(); ^~~~~~~~~ arp_scan.c:189:16: error: &#39;arpco&#39; undeclared (first use in this function); did you mean &#39;arp_op&#39;? usleep(arpco.scan_interval); ^~~~~ arp_op arp_scan.c:191:12: error: &#39;OK&#39; undeclared (first use in this function) return OK; ^~ arp_scan.c: At top level: arp_scan.c:194:27: error: unknown type name &#39;DS_MSG&#39; LOCAL int arp_scan_reload(DS_MSG *msg) ^~~~~~ arp_scan.c:249:12: error: static declaration of &#39;arp_scan_main&#39; follows non-static declaration LOCAL void arp_scan_main() ^~~~~~~~~~~~~ In file included from arp_scan.c:13: arp_scan.h:64:12: note: previous declaration of &#39;arp_scan_main&#39; was here LOCAL void arp_scan_main(); ^~~~~~~~~~~~~ arp_scan.c: In function &#39;arp_scan_main&#39;: arp_scan.c:251:5: error: unknown type name &#39;DS_OPT_DESC&#39; DS_OPT_DESC main_options[] = ^~~~~~~~~~~ arp_scan.c:253:13: error: implicit declaration of function &#39;DS_SWITCH_OPT&#39; [-Werror=implicit-function-declaration] DS_SWITCH_OPT(arp_config_t, enabled, OPT_FLAG_NORM), ^~~~~~~~~~~~~ arp_scan.c:253:27: error: expected expression before &#39;arp_config_t&#39; DS_SWITCH_OPT(arp_config_t, enabled, OPT_FLAG_NORM), ^~~~~~~~~~~~ arp_scan.c:254:13: error: implicit declaration of function &#39;DS_STR_OPT&#39;; did you mean &#39;N_STRIP&#39;? [-Werror=implicit-function-declaration] DS_STR_OPT(arp_config_t, start_ip, OPT_FLAG_NORM), ^~~~~~~~~~ N_STRIP arp_scan.c:254:24: error: expected expression before &#39;arp_config_t&#39; DS_STR_OPT(arp_config_t, start_ip, OPT_FLAG_NORM), ^~~~~~~~~~~~ arp_scan.c:255:24: error: expected expression before &#39;arp_config_t&#39; DS_STR_OPT(arp_config_t, end_ip, OPT_FLAG_NORM), ^~~~~~~~~~~~ arp_scan.c:256:13: error: implicit declaration of function &#39;DS_S32_OPT&#39; [-Werror=implicit-function-declaration] DS_S32_OPT(arp_config_t, scan_interval, OPT_FLAG_NORM), ^~~~~~~~~~ arp_scan.c:256:24: error: expected expression before &#39;arp_config_t&#39; DS_S32_OPT(arp_config_t, scan_interval, OPT_FLAG_NORM), ^~~~~~~~~~~~ arp_scan.c:257:24: error: expected expression before &#39;arp_config_t&#39; DS_S32_OPT(arp_config_t, packet_interval, OPT_FLAG_NORM), ^~~~~~~~~~~~ arp_scan.c:258:24: error: expected expression before &#39;arp_config_t&#39; DS_S32_OPT(arp_config_t, entry_lifetime, OPT_FLAG_NORM), ^~~~~~~~~~~~ arp_scan.c:261:5: error: unknown type name &#39;DS_SEG_DESC&#39; DS_SEG_DESC main_segments[] = ^~~~~~~~~~~ arp_scan.c:263:13: error: implicit declaration of function &#39;DS_STRUCT_SEG&#39; [-Werror=implicit-function-declaration] DS_STRUCT_SEG("config", SEG_LIM_RW, SEG_GROUP_ROOT, arp_config_t, main_options), ^~~~~~~~~~~~~ arp_scan.c:263:37: error: &#39;SEG_LIM_RW&#39; undeclared (first use in this function) DS_STRUCT_SEG("config", SEG_LIM_RW, SEG_GROUP_ROOT, arp_config_t, main_options), ^~~~~~~~~~ arp_scan.c:263:49: error: &#39;SEG_GROUP_ROOT&#39; undeclared (first use in this function) DS_STRUCT_SEG("config", SEG_LIM_RW, SEG_GROUP_ROOT, arp_config_t, main_options), ^~~~~~~~~~~~~~ arp_scan.c:263:65: error: expected expression before &#39;arp_config_t&#39; DS_STRUCT_SEG("config", SEG_LIM_RW, SEG_GROUP_ROOT, arp_config_t, main_options), ^~~~~~~~~~~~ arp_scan.c:266:5: error: unknown type name &#39;DS_SECT_DESC&#39; DS_SECT_DESC arp_scan_sections[] = ^~~~~~~~~~~~ arp_scan.c:268:13: error: implicit declaration of function &#39;DS_STRUCT_SECT&#39; [-Werror=implicit-function-declaration] DS_STRUCT_SECT("config", main_segments), ^~~~~~~~~~~~~~ arp_scan.c:271:5: error: unknown type name &#39;DS_TBL_DESC&#39; DS_TBL_DESC arp_scan_tables[] = ^~~~~~~~~~~ arp_scan.c:273:13: error: implicit declaration of function &#39;DS_STRUCT_TBL&#39; [-Werror=implicit-function-declaration] DS_STRUCT_TBL("arp_scan", TBL_ATTR_STC, arp_scan_sections), ^~~~~~~~~~~~~ arp_scan.c:273:39: error: &#39;TBL_ATTR_STC&#39; undeclared (first use in this function) DS_STRUCT_TBL("arp_scan", TBL_ATTR_STC, arp_scan_sections), ^~~~~~~~~~~~ arp_scan.c:275:5: error: unknown type name &#39;DS_DAT_MON_DESC&#39; DS_DAT_MON_DESC arp_data_monitor[] = ^~~~~~~~~~~~~~~ arp_scan.c:277:13: error: implicit declaration of function &#39;DS_DAT_MON&#39;; did you mean &#39;SHRT_MIN&#39;? [-Werror=implicit-function-declaration] DS_DAT_MON(ARP_DATA_PATH, DATA_ATTRI_NOTIFY), ^~~~~~~~~~ SHRT_MIN arp_scan.c:277:24: error: &#39;ARP_DATA_PATH&#39; undeclared (first use in this function) DS_DAT_MON(ARP_DATA_PATH, DATA_ATTRI_NOTIFY), ^~~~~~~~~~~~~ arp_scan.c:277:39: error: &#39;DATA_ATTRI_NOTIFY&#39; undeclared (first use in this function) DS_DAT_MON(ARP_DATA_PATH, DATA_ATTRI_NOTIFY), ^~~~~~~~~~~~~~~~~ arp_scan.c:280:5: error: unknown type name &#39;DS_MOD_DESC&#39; DS_MOD_DESC arp_scan_module = DS_STRUCT_MOD("arp_scan", arp_scan_init, arp_scan_check, arp_scan_reload, arp_scan_start, ^~~~~~~~~~~ arp_scan.c:280:35: error: implicit declaration of function &#39;DS_STRUCT_MOD&#39; [-Werror=implicit-function-declaration] DS_MOD_DESC arp_scan_module = DS_STRUCT_MOD("arp_scan", arp_scan_init, arp_scan_check, arp_scan_reload, arp_scan_start, ^~~~~~~~~~~~~ arp_scan.c:280:92: error: &#39;arp_scan_reload&#39; undeclared (first use in this function); did you mean &#39;arp_scan_module&#39;? DS_MOD_DESC arp_scan_module = DS_STRUCT_MOD("arp_scan", arp_scan_init, arp_scan_check, arp_scan_reload, arp_scan_start, ^~~~~~~~~~~~~~~ arp_scan_module arp_scan.c:283:5: error: unknown type name &#39;MODULE&#39; MODULE *module_node = ds_register_module("arp_scan", &arp_module); ^~~~~~ arp_scan.c:283:27: error: implicit declaration of function &#39;ds_register_module&#39; [-Werror=implicit-function-declaration] MODULE *module_node = ds_register_module("arp_scan", &arp_module); ^~~~~~~~~~~~~~~~~~ arp_scan.c:283:59: error: &#39;arp_module&#39; undeclared (first use in this function); did you mean &#39;arp_scan_module&#39;? MODULE *module_node = ds_register_module("arp_scan", &arp_module); ^~~~~~~~~~ arp_scan_module arp_scan.c:283:27: error: initialization of &#39;int *&#39; from &#39;int&#39; makes pointer from integer without a cast [-Werror=int-conversion] MODULE *module_node = ds_register_module("arp_scan", &arp_module); ^~~~~~~~~~~~~~~~~~ arp_scan.c:284:5: error: implicit declaration of function &#39;NSD_ASSERT&#39;; did you mean &#39;FD_ISSET&#39;? [-Werror=implicit-function-declaration] NSD_ASSERT(NULL != module_node); ^~~~~~~~~~ FD_ISSET arp_scan.c:280:17: error: unused variable &#39;arp_scan_module&#39; [-Werror=unused-variable] DS_MOD_DESC arp_scan_module = DS_STRUCT_MOD("arp_scan", arp_scan_init, arp_scan_check, arp_scan_reload, arp_scan_start, ^~~~~~~~~~~~~~~ arp_scan.c:251:17: error: unused variable &#39;main_options&#39; [-Werror=unused-variable] DS_OPT_DESC main_options[] = ^~~~~~~~~~~~ arp_scan.c: At top level: arp_scan.c:286:1: error: data definition has no type or storage class [-Werror] NSD_INIT(arp_scan_main); ^~~~~~~~ arp_scan.c:286:1: error: type defaults to &#39;int&#39; in declaration of &#39;NSD_INIT&#39; [-Werror=implicit-int] arp_scan.c:286:1: error: parameter names (without types) in function declaration [-Werror] arp_scan.c:249:12: error: &#39;arp_scan_main&#39; defined but not used [-Werror=unused-function] LOCAL void arp_scan_main() ^~~~~~~~~~~~~
08-27
上述代码存在如下报错: rtsp_server_module.c: In function &#39;generate_psk&#39;: rtsp_server_module.c:2646:5: error: &#39;for&#39; loop initial declarations are only allowed in C99 or C11 mode for(int i=0; i<sizeof(bin_key); i++) { ^ rtsp_server_module.c:2646:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code rtsp_server_module.c:2654:13: error: implicit declaration of function &#39;mbedtls_ctr_drbg_random_string&#39; [-Werror=implicit-function-declaration] "IPC_DEVICE_%08X", mbedtls_ctr_drbg_random_string(&ctr_drbg, 8)); ^ rtsp_server_module.c: In function &#39;rtsps_psk_init&#39;: rtsp_server_module.c:2739:21: error: passing argument 1 of &#39;generate_psk&#39; from incompatible pointer type [-Werror] if(generate_psk(&client_psk) == 0) { ^ rtsp_server_module.c:2622:5: note: expected &#39;struct psk_s *&#39; but argument is of type &#39;struct OPENAPI_PSK *&#39; int generate_psk(psk_s* psk_ctx) { ^ In file included from common/TPPlayerCommon.h:3:0, from rtsp_server_module.c:7: rtsp_server_module.c:2741:55: error: &#39;my_psk&#39; undeclared (first use in this function) RTSP_INFO_LOG("Generated PSK Identity: %s\n", my_psk.key_id); ^ /home/shihaopeng/nvmp/NVMP/nvmp/build_dir/target-arm-openwrt-linux-uclibcgnueabi-c202v2/avts/avts_common.h:106:54: note: in definition of macro &#39;AVTS_LOG&#39; msg_push_log(level, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__); \ ^ rtsp_server_module.c:2741:9: note: in expansion of macro &#39;RTSP_INFO_LOG&#39; RTSP_INFO_LOG("Generated PSK Identity: %s\n", my_psk.key_id); ^ rtsp_server_module.c:2741:55: note: each undeclared identifier is reported only once for each function it appears in RTSP_INFO_LOG("Generated PSK Identity: %s\n", my_psk.key_id); ^ /home/shihaopeng/nvmp/NVMP/nvmp/build_dir/target-arm-openwrt-linux-uclibcgnueabi-c202v2/avts/avts_common.h:106:54: note: in definition of macro &#39;AVTS_LOG&#39; msg_push_log(level, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__); \ ^ rtsp_server_module.c:2741:9: note: in expansion of macro &#39;RTSP_INFO_LOG&#39; RTSP_INFO_LOG("Generated PSK Identity: %s\n", my_psk.key_id); 请分析原因并给出修改
09-17
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值