Skip to main content
WIF
Associate II
October 31, 2022
Solved

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

  • October 31, 2022
  • 2 replies
  • 1982 views

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.
Best answer by Pavel A.

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.Answer
Super User
October 31, 2022

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
November 2, 2022

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

Thanks again