2018-10-04 12:46 AM
Hello, I'm using stm32l152re nucleo board and I've to connect an accelerometer with I2c.
All is ok, but when I build the project the linker says "Undefined reference to HAL_I2C_MASTER_TRANSMIT". That's a function of stm32l1xx_hal_i2c.h and I can't understand why the linker gives error. I've checked all the inclusions , but it still doesn't work.
could you help me , please?
2018-10-04 12:59 AM
> That's a function of stm32l1xx_hal_i2c.h and I can't understand why the linker gives error
Header files are for declarations only (by convention, actually).
You need to add the respective *.c file containing the implementation to your project.
2018-10-04 01:24 AM
The .c file is in Drivers Folder and I enabled the I2C with declaration "I2C_HandleTypeDef hi2c; ".
Maybe, can I move this file to 'src' folder ?
2018-10-04 01:30 AM
I don't know SW4STM32, and it's project organization.
But usually, you don't need to move files to add them to a project.
Organization of source files within a project would be your (the developer's) task, within the restrictions enforced by the IDE's project metaphor. Eclipse in your case.