2

我面临一个链接器错误:

.\STM32F4xx-Nucleo\DMA_LP_App.axf: Error: L6218E: Undefined symbol HAL_UART_Init (referred from main.o).

我已经添加了文件stm32f4xx_hal_uart.c及其路径,option -> C/C++ -> include path但它仍然显示错误。

我已经通过 RTE 管理器添加了文件,但仍然是同样的错误。

如果我添加文件两次,它会显示:

.\STM32F4xx-Nucleo\DMA_LP_App.axf: Error: L6200E: Symbol __asm___20_stm32f4xx_hal_uart_c____REV16 multiply defined (by stm32f4xx_hal_uart_1.o and stm32f4xx_hal_uart.o).

请告诉我是什么导致了这个问题以及可能的解决方案。

4

2 回答 2

1

通过使用定义来启用项目stm32f4xx_hal_conf.h文件中的模块来解决问题。

于 2017-03-07T16:15:07.360 回答
1

当我将.c文件移动到 C++ 项目时,我遇到了同样的问题。要解决这个问题,我必须添加这些行:

#include "abcxyz.h" //etc
#ifdef __cplusplus
extern "C" {
#endif

/* Contents of your source file */

#ifdef __cplusplus
}
#endif
于 2019-05-14T14:13:48.263 回答