我是STM32 MCU编程的新手,我在TrueStudio上启动了一个SPI项目。我也需要一个LCD库,因此我调整了一个与我一起使用的现有库,并在Inc
和Src
下添加了这些文件。
当我尝试编译时,我得到一个错误,说明在函数中第一次使用了先前未声明的定义,但是,它们已在相应的头文件中定义,并且该头文件已被定义包含在C文件中。我错过了什么?我所有的错误似乎都出现在了HD44780.c中。文件。我还要提一下,我使用CubeMX软件生成引脚定义源代码。该项目的拉链可用here。
任何帮助将不胜感激! 编辑:此处列出了完整的错误消息:
Description Resource Path Location Type
'HD44780_D4_GPIO_PORT' undeclared (first use in this function) HD44780.c /STM32F103C6T8_SPI/Src line 242 C/C++ Problem
'HD44780_D5_GPIO_PORT' undeclared (first use in this function) HD44780.c /STM32F103C6T8_SPI/Src line 241 C/C++ Problem
'HD44780_D6_GPIO_PORT' undeclared (first use in this function) HD44780.c /STM32F103C6T8_SPI/Src line 240 C/C++ Problem
'HD44780_D7_GPIO_PORT' undeclared (first use in this function) HD44780.c /STM32F103C6T8_SPI/Src line 239 C/C++ Problem
'HD44780_E_GPIO_PORT' undeclared (first use in this function) HD44780.c /STM32F103C6T8_SPI/Src line 39 C/C++ Problem
'HD44780_RS_GPIO_PORT' undeclared (first use in this function) HD44780.c /STM32F103C6T8_SPI/Src line 36 C/C++ Problem
'HD44780_RS_GPIO_PORT' undeclared (first use in this function) HD44780.c /STM32F103C6T8_SPI/Src line 37 C/C++ Problem
Warnings
implicit declaration of function 'DELAY_Init' [-Wimplicit-function-declaration] HD44780.c /STM32F103C6T8_SPI/Src line 81 C/C++ Problem
Info
each undeclared identifier is reported only once for each function it appears in HD44780.c /STM32F103C6T8_SPI/Src line 36 C/C++ Problem
in expansion of macro 'HD44780_E_BLINK' HD44780.c /STM32F103C6T8_SPI/Src line 243 C/C++ Problem
in expansion of macro 'HD44780_E_HIGH' HD44780.c /STM32F103C6T8_SPI/Src line 41 C/C++ Problem
in expansion of macro 'HD44780_RS_HIGH' HD44780.c /STM32F103C6T8_SPI/Src line 229 C/C++ Problem
in expansion of macro 'HD44780_RS_LOW' HD44780.c /STM32F103C6T8_SPI/Src line 219 C/C++ Problem
答案 0 :(得分:3)
在main.h中,您定义的是HD44780_*_GPIO_Port
而不是HD44780_*_GPIO_PORT
。请注意全大写PORT
。