cancel
Showing results for 
Search instead for 
Did you mean: 

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

WIF
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

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 ?

View solution in original post

2 REPLIES 2
Pavel A.
Evangelist III

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
Associate II

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

Thanks again