stm32 gnu tools version 13.3.rel1 undefined reference linker error
- April 29, 2026
- 1 reply
- 232 views
I have installed version 13.3.rel1, clean the files and re compile the code :
I have a linker error "undefined reference" to a function although the function referenced in the files and declared in the H file who was included.
"
C:/ST/STM32CubeIDE_2.0.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.100.202509120712/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: ./Core/Src/stm32u0xx_hal_msp.o: in function `HAL_PCD_MspInit':
C:/Users/../Electronics/../Software/USB_CDC_U0/USB_CDC_U0/Debug/../Core/Src/stm32u0xx_hal_msp.c:102:(.text.HAL_PCD_MspInit+0x4c): undefined reference to `MX_USB_CDC_Init'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:65: USB_CDC_U0.elf] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.
15:33:51 Build Failed. 2 errors, 0 warnings. (took 13s.995ms)
I have tried the following:
1. I have tried changing the file order in "path and symbols" clean and recompile - no success
2. I have tried changing the function name - - no success
3. I have deleted the object files in the debug section clean the code and re-compile - no success.
currently I am using version 13.3.rel1 of STM32 GNU and CubeIDE 2.1.1 tools downgraded from version 14.3.rel1 due to other errors encountered while compiling the code - see the link below:
I have attached the code
Please help
UVC100