[STM32G0] STM32CubeIDE编译工程错误问题

[复制链接]
 楼主| lymmmmm 发表于 2024-11-11 23:12 | 显示全部楼层 |阅读模式
使用CubeIDE编译出错,已经重装过CubeIDE,问题依旧存在,各位大神有什么解决办法码
make -j32 all
arm-none-eabi-gcc -o "GPIO_LED_SEGMENT_3.elf" @"objects.list"   -mcpu=cortex-m0plus -T"C:\Users\lenovo\STM32CubeIDE\workspace_1.10.1\GPIO_LED_SEGMENT_3\STM32G070RBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="GPIO_LED_SEGMENT_3.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `bsp_led_on':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:33: multiple definition of `bsp_led_on'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:33: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `bsp_led_off':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:43: multiple definition of `bsp_led_off'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:43: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `bsp_led_toggle':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:53: multiple definition of `bsp_led_toggle'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:53: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `HAL_GPIO_EXTI_Rising_Callback':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:61: multiple definition of `HAL_GPIO_EXTI_Rising_Callback'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:61: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `HAL_GPIO_EXTI_Falling_Callback':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:80: multiple definition of `HAL_GPIO_EXTI_Falling_Callback'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:80: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `bsp_seg_show':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:111: multiple definition of `bsp_seg_show'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:111: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `bsp_buz_on':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:146: multiple definition of `bsp_buz_on'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:146: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `bsp_buz_off':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:156: multiple definition of `bsp_buz_off'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:156: first defined here
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/stm32g0xx_it.o: in function `bsp_buz_conf':
C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:165: multiple definition of `bsp_buz_conf'; ./Core/Src/MY_bsp.o:C:/Users/lenovo/STM32CubeIDE/workspace_1.10.1/GPIO_LED_SEGMENT_3/Debug/../Core/Src/MY_bsp.c:165: first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:64: GPIO_LED_SEGMENT_3.elf] Error 1
"make -j32 all" terminated with exit code 2. Build might be incomplete.
classroom 发表于 2024-11-12 11:24 | 显示全部楼层
检查编译器设置是否有问题
cr315 发表于 2024-11-12 11:29 | 显示全部楼层
SDK版本是否与CubeIDE兼容。
elephant00 发表于 2024-11-12 11:30 | 显示全部楼层
如果最近更新了SDK,尝试回退到之前的版本看是否能解决问题。
反之,如果使用的是较旧的SDK版本,尝试更新到最新版本。
laocuo1142 发表于 2024-11-12 14:00 | 显示全部楼层
编译器是否启用了正确的调试模式或优化级别
flycamelaaa 发表于 2024-11-12 14:00 | 显示全部楼层
项目中的源文件(.c、.cpp等)和头文件(.h)是否都已正确添加到项目中。

评论

是的  发表于 2024-11-12 21:19
powerantone 发表于 2024-11-12 15:00 | 显示全部楼层
检查项目是否包含所有必要的库和依赖项。
stormwind123 发表于 2024-11-12 16:56 | 显示全部楼层
删除项目中的Debug和Release文件夹(如果存在),然后重新构建项目。
 楼主| lymmmmm 发表于 2024-11-12 21:17 | 显示全部楼层
stormwind123 发表于 2024-11-12 16:56
删除项目中的Debug和Release文件夹(如果存在),然后重新构建项目。

试过了,没有用诶
两只袜子 发表于 2024-11-12 22:00 | 显示全部楼层
检查代码中是否存在语法错误、未定义的变量或函数等。
jcky001 发表于 2024-11-12 23:00 | 显示全部楼层
更新或回退SDK版本
probedog 发表于 2024-11-13 11:00 | 显示全部楼层
在CubeIDE中,可以使用“Project”菜单下的“Clean”选项来清理项目。
斧王FUWANG 发表于 2024-12-31 23:35 | 显示全部楼层
尝试清理项目、删除bin文件夹并重新编译,或检查工具链配置是否正确。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

3

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部