..\HARDWARE\USART3\usart3.h(21): error: #147: declaration is incompatible with "uint8_t USART2_RX_BUF[512]" (declared at line 12 of "..\SYSTEM\usart\usart.h") extern u8 USART2_RX_BUF[
时间: 2023-06-19 07:07:49 浏览: 612
这个错误是因为你在usart3.h中定义了一个名为USART2_RX_BUF的变量,但是在usart.h中也已经定义了一个同名的变量,并且它们的类型不一致,导致冲突。
解决这个错误的方法是修改usart3.h中的变量名,或者使用usart.h中定义的同名变量。如果你确定需要在usart3.h中定义一个新的变量,那么应该修改变量名以避免与其他文件中的变量冲突。
相关问题
compiling usart.c... ..\SYSTEM\usart\usart.c(148): error: #79: expected a type specifier USART_ClearITPendingBit(USART1, USART_IT_RXNE); ..\SYSTEM\usart\usart.c(148): error: #79: expected a type specifier USART_ClearITPendingBit(USART1, USART_IT_RXNE); ..\SYSTEM\usart\usart.c(148): warning: #77-D: this declaration has no storage class or type specifier USART_ClearITPendingBit(USART1, USART_IT_RXNE); ..\SYSTEM\usart\usart.c(148): error: #147: declaration is incompatible with "void USART_ClearITPendingBit(USART_TypeDef *, uint16_t)" (declared at line 393 of "..\STM32F10x_FWLib\inc\stm32f10x_usart.h") USART_ClearITPendingBit(USART1, USART_IT_RXNE); ..\SYSTEM\usart\usart.c(149): error: #169: expected a declaration } ..\SYSTEM\usart\usart.c(152): warning: At end of source: #12-D: parsing restarts here after previous syntax error ..\SYSTEM\usart\usart.c: 2 warnings, 4 errors "..\SYSTEM\usart\usart.c" - 4 Error(s), 2 Warning(s).
根据你提供的错误信息,编译usart.c时出现了一些问题。其中,第一个错误是在第148行,缺少了类型说明符。第二个错误也是在第148行,同样缺少了类型说明符。第三个错误是在第148行,这个声明缺少了存储类或类型说明符。第四个错误是在第148行,这个声明与在"..\STM32F10x_FWLib\inc\stm32f10x_usart.h"文件的第393行声明的 "void USART_ClearITPendingBit(USART_TypeDef *, uint16_t)" 不兼容。第五个错误是在第149行,缺少了一个声明。最后一个警告是在第152行,源码结束后重新开始解析。
根据这些信息,你需要检查usart.c文件的第148行和149行的代码,并确保声明的类型和参数与之前的声明匹配。此外,还要确保代码的结构正确,没有语法错误。
main.c(4): error: #147-D: declaration is incompatible with "void GPIO_Init(GPIO_TypeDef *, GPIO_InitTypeDef *)" (declared at line 351 of "..\STM32F10x_FWLib\inc\stm32f10x_gpio.h") void GPIO_Init(void); main.c(10): error: #268: declaration may not appear after executable statement in block uint8_t i = 0; main.c(10): error: #67: expected a "}" uint8_t i = 0; main.c(11): error: #147: declaration is incompatible with "void USART1_Init(void)" (declared at line 3) USART1_Init(); main.c(12): error: #169: expected a declaration while(1) { //???????以上错误应该如何修改
这些错误的原因可能是你的代码中存在一些语法错误或者函数声明与实际函数实现不匹配。下面是一些可能的修改方法:
1. 在函数声明中添加参数类型和变量名,以与实际函数实现匹配。
2. 将变量声明放在函数之前,或者将变量声明放在代码块的开头。
3. 检查语法错误,例如括号是否匹配、分号是否漏掉等。
4. 检查头文件是否正确引入,特别是 GPIO_Init 和 USART1_Init 所在的头文件。
具体修改方法需要根据你的代码具体情况来决定。
阅读全文
相关推荐

















