Skip to main content
WIF
Associate II
Oct 31, 2022 8:57 PM UTC
Solved

Code regenerate settings for STM32CubeMX after adding a new Peripheral to prevent Multiple definition errors

0693W00000VOXTNQA5.pngI was given a code to add USB support to the firmware. I am using Stm32CubeMX to generated the boiler plate for the USB. I enabled the USB peripheral and reconfigure the clock setting and regenerate the code. When I try building the fresh project after code generation, it is throwing multiple definition error. I need help how to set the option to regenerate the code without the multiple definition. I thought of adding the USB peripheral manually but I believe the clock configuration will prove challenging for me now. Also the project was done with an older version of CubeMX and I used the migration option offered by CubeMX to migrate the project to the current version of CubeMX

Thanks

This topic has been closed for replies.
Pavel A.
Pavel A.Best answer
Oct 31, 2022 10:39 PM UTC

Delete subdirectory Source/Templates with all its contents and refresh the project.

Templates should never be copied literally into user project.

Also note that main() is missing - not clear why. Is there main.c ?

2 replies

Pavel A.
Pavel A.Best answer
Oct 31, 2022 10:39 PM UTC

Delete subdirectory Source/Templates with all its contents and refresh the project.

Templates should never be copied literally into user project.

Also note that main() is missing - not clear why. Is there main.c ?

WIF
WIFAuthor
Associate II
Nov 2, 2022 5:41 PM UTC

Yes there is main.c. The issue was the template folder.

Thanks again