首页 > 解决方案 > 重新安装工具链后出现大量“多重定义”

问题描述

我正在开发开源 ARDF 发射器(https://github.com/WhiteFossa/yiff-l),目前正在开发固件。

在固件中(使用 Eclipse Embedded CDT 用 C 语言为 STM32F103 编写)我有很多 .h 文件,它们都包含在 main.h 中,然后 main.h 包含在所有 .c 文件中。

这种方法效果很好,我的代码是可编译的等等。

然后由于某种原因我不得不重新安装我的 Fedora,当然,还要重新安装工具链、Eclipse 等。

现在我收到大量(准确地说是 1087)错误消息,如下所示:

(.text+0x0): multiple definition of `L2HAL_SSD1327_Context'; ./src/l2hal/src/l2hal.o (symbol from plugin):(.text+0x0): first defined here
/home/fossa/.local/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/10.2.1-1.1.2/.content/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ./src/stm32f1xx_it.o (symbol from plugin): in function `NMI_Handler':
(.text+0x0): multiple definition of `I2C_Other'; ./src/l2hal/src/l2hal.o (symbol from plugin):(.text+0x0): first defined here
/home/fossa/.local/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/10.2.1-1.1.2/.content/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ./src/stm32f1xx_it.o (symbol from plugin): in function `NMI_Handler':
(.text+0x0): multiple definition of `I2C_Display'; ./src/l2hal/src/l2hal.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [makefile:87: Yiff-HL.elf] Error 1
"make -j all" terminated with exit code 2. Build might be incomplete.

14:31:50 Build Failed. 1087 errors, 4 warnings. (took 1s.30ms)

有人可以帮我解决这个问题吗?

代码(以及我的包含方式)有问题吗?或者,也许是编译器/链接器设置有问题?

提前致谢。

标签: cembeddedstm32

解决方案


推荐阅读