3

I am using IAR Workbench to compile my codes,

Even I added all Stm32 Hal library in folder and objects>processor in my project

I get this errors:

  [ErrorLi005]:  no definition for "HAL_SPI_Init" [referenced from C:\Users\Desktop\Project\EWARM\Project\Obj\api_lib.o
   [ErrorLi005]: no definition for "HAL_I2C_Init" [referenced from C:\Users\Desktop\Project\EWARM\Project\Obj\api_lib.o
   [ErrorLi005]:  no definition for "HAL_USART_Init" [referenced from C:\Users\Desktop\Project\EWARM\Project\Obj\api_lib.o
  [ErrorLi005]:  no definition for "HAL_ETH_Init" [referenced from C:\Users\Desktop\Project\EWARM\Project\Obj\api_lib.o
    ...
    Linking error

How can I solve this error ?

gogogo
  • 529
  • 1
  • 3
  • 11

1 Answers1

1

You haven't told linker to use the library file, so it cannot find matching symbols which you are using in your object files.

Assuming your library is already compiled (.a or .lib file), go to Project > Options... > Category: Linker > Library and add your library file to Additional libraries box.

user694733
  • 15,208
  • 2
  • 42
  • 68
  • I added libraires it solved this problem but I have an another problem now; I get Msp_Init function already defined in another trasnlation unit erorr but I have just one hal_msp.c file in source file . – gogogo Sep 22 '20 at 11:15
  • A mean I have a hal_msp.c file and this file include Msp_Init functions – gogogo Sep 22 '20 at 11:21
  • 1
    @gogogo Unfortunately I cannot determine the problem based on that description. Since you have new problem, then please ask completely new question. – user694733 Sep 22 '20 at 11:22