Showing results for 
Search instead for 
Did you mean: 

Getting the linker file issue on STM32CubeIDE - Undefined Reference

Associate II


I'm trying to build my project  on STM32CubeIDE, there was some issues and errors which I got resolved after that when I'm trying to linking my project with the linker which is named as STM32F105RBTX_FLASH.ld. it's throwing an error


(.text.__libc_init_array+0x12): undefined reference to `_init'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:77: CAN.elf] Error 1
"make -j16 all" terminated with exit code 2. Build might be incomplete.

undefined reference to `HAL_CAN_AddTxMessage'

undefined reference to `HAL_GetTick'

undefined reference to `HAL_HalfDuplex_EnableTransmitter'


and many more like that. Please, if anybody help me out in resolving them it would be much appreciated.

Andrew Neil
Evangelist III

So is your other question resolved now?

If so, please mark the solution in that thread.

An undefined reference means that you have called a function, but you haven't provided any definition of that function.

In the case of the HAL_ functions, the definitions would be in the hal_*.c files - so it sounds like you haven't added the HAL source files to your project.