构建错误,"undeclared (first use in function)" 错误但已声明

Build error, "undeclared (first use in function)" error but it has been declared

我是 STM32 MCU 编程的新手,我在 TrueStudio 上开始了一个 SPI 项目。我也需要一个 LCD 库,因此我调整了一个现有的库以供我使用,并将这些文件添加到 IncSrc 下。

当我尝试编译时,我收到一条错误消息,指出函数中第一次使用了先前未声明的定义,但是,它们已在相应的头文件中定义,并且该头文件已被包含在 C 文件中。我错过了什么?我所有的错误似乎都在 'HD44780.c' 文件中。我还应该提到我使用 CubeMX 软件生成引脚定义源代码。项目的 zip 文件可用 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

在 main.h 中,您定义的是 HD44780_*_GPIO_Port 而不是 HD44780_*_GPIO_PORT。注意全大写 PORT.