keil中error: #70: incomplete type is not allowed—解决方法

本文介绍在Keil中使用外部数组时遇到的编译错误,详细解释了如何通过固定数组大小来解决该问题,确保程序正确编译。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天在写程序的时候,想使用sizeof求数组的大小,数组中其他c文件定义,在头文件使用extern uint8_t buff_value[]; 声明

但是keil编译报错,网上查了,发现,需要写成extern uint8_t buff_value[30];把数组的大小固定了,才能编译通过。

Build started: Project: 111 *** Using Compiler &#39;V5.06 update 7 (build 960)&#39;, folder: &#39;D:\keil5\ARM\ARMCC\Bin&#39; Build target &#39;Target 1&#39; compiling stm32f10x_it.c... user\stm32f10x_it.c(16): error: #70: incomplete type is not allowed if(rx_index < sizeof(USART_RxBuffer)-1) { user\stm32f10x_it.c: 0 warnings, 1 error compiling main.c... user\main.c(44): error: #165: too few arguments in function call OLED_ShowChar(0, 0, &#39;T&#39;); // 浣跨敤ASCII瀛楃 user\main.c(45): error: #165: too few arguments in function call OLED_ShowChar(0, 16, &#39;H&#39;); user\main.c(46): error: #165: too few arguments in function call OLED_ShowChar(64, 16, &#39;%&#39;); user\main.c(47): error: #165: too few arguments in function call OLED_ShowChar(64, 0, &#39;C&#39;); user\main.c(75): warning: #223-D: function "delay_ms" declared implicitly delay_ms(5000); // 姣?5绉掓洿鏂? user\main.c(56): warning: #177-D: variable "lastSendTime" was declared but never referenced uint32_t lastSendTime = 0; user\main.c: 2 warnings, 4 errors compiling esp8266.c... user\esp8266.c(21): warning: #223-D: function "HAL_GetTick" declared implicitly uint32_t start = HAL_GetTick(); user\esp8266.c(27): warning: #223-D: function "delay_ms" declared implicitly delay_ms(50); user\esp8266.c(82): warning: #223-D: function "sprintf" declared implicitly sprintf(cmd, "AT+CIPSEND=0,%d\r\n", strlen(data)); user\esp8266.c: 3 warnings, 0 errors ".\Objects\project.axf" - 5 Error(s), 5 Warning(s). Target not created. Build Time Elapsed: 00:00:01解决这些程序报错
07-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值