This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with Linker: undefined

Hey everyone,
I know this post has been done a lot of times, but people solve it by adding the .c files after including the header file in the corresponding file.
The thing is, I've already done this. I just got the STM32 Nucleo with the VL6180 Expansion Board (academic purposes), and I'm trying to communicate with it via UART.
I keep getting this error:


*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Rebuild target 'NucleoF401RangingAndALS'
compiling vl6180x_i2c.c...
compiling vl6180x_api.c...
assembling startup_stm32f401xe.s...
compiling stm32f4xx_it.c...
compiling stm32f4xx_hal_tim_ex.c...
compiling stm32f4xx_hal_msp.c...
compiling system_stm32f4xx.c...
compiling stm32f4xx_hal_tim.c...
compiling x-nucleo-6180xa1.c...
compiling main.c...
compiling stm32f4xx_hal_gpio.c...
compiling stm32f4xx_hal_uart.c...
compiling stm32f4xx_hal_pwr.c...
compiling stm32f4xx_hal_flash.c...
compiling stm32f4xx_hal_usart.c...
compiling stm32f4xx_hal_rcc.c...
compiling stm32f4xx_hal_i2c.c...
compiling stm32f4xx_hal_dma.c...
compiling stm32f4xx_hal_i2c_ex.c...
compiling stm32f4xx_hal_dma_ex.c...
compiling stm32f4xx_hal_pwr_ex.c...
compiling stm32f4xx_hal_flash_ramfunc.c...
compiling stm32f4xx_hal.c...
compiling stm32f4xx_hal_flash_ex.c...
compiling stm32f4xx_hal_rcc_ex.c...
compiling stm32f4xx_hal_cortex.c...
linking...
NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_TIMEx_MasterConfigSynchronization (referred from main.o).
NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_TIM_Base_Init (referred from main.o).
NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_TIM_ConfigClockSource (referred from main.o).
NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_UART_Init (referred from main.o).
NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_UART_Transmit (referred from main.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 5 error messages.
"NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf" - 5 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:13

Those "undefined symbols" are defined on the bold files, and are being compiled.
Did I add them incorrectly of something?
I'm using Keil uVision 5. (I added the source files by adding them to the file tree on the left.
Screenshot of the tree -> i66.tinypic.com/a5j38p.jpg
What am I doing wrong?

Thanks for the help, Alan.

  • Hello Alan,

    ST's HAL layer's function definitions often depend on macros defined in
    stm32f4xx_hal_conf.h. Sometimes these are defined elsewhere, like in Options for Target (blue wand icon) => C/C++ tab => "Define:". I'd look over some CubeMX examples in ST's repository, to understand how to enable their peripherals, using the CubeMX HAL layer.

    The L6218E error can also be returned if the function's output/input in the extern line does not match it's defined parameters or output types.

    To assure header files can be found, an easier way is to include the directories to the header files in Options for Target => C/C++ tab => Include paths. This is only necessary if the header files are stored in a different location than the source file trying to use it.

    Thanks,
    Zack