linker-errorsnrf51

IAR Error[Li005] : no definition for function even though the file is added in the project and the path to the file is in the pre-processor paths


I am having a strange problem. I am trying to integrate the spi module from Nordic Semiconductors peripherals examples with the Central BLE Uart project.

There is a library of component common to all the examples. So what I did is add the spi_slave file nrf_drv_spis.c to my project, and added the path to that component in the preprocessor paths of the project.

$PROJ_DIR$\..\..\..\..\..\..\..\components\drivers\nrf_spi_slave is in my preprocessor paths and this is where nrf_drv_spis.c and nrf_drv_spis.h are.

However, when I compiled the code, I get this error

Error[Li005]: no definition for "nrf_drv_spis_init" [referenced from D:\Repo\ble_projects\nRF5_SDK_12.3.0\examples\ble_central\ble_app_uart_c\pca10028\s130\iar\_build\main.o] 

nrf_drv_spis_init is a function found in nrf_drv_spis.c and the prototype is in nrf_drv_spis.h. The odd thing as well is that when I right click on nrf_drv_spis_init and "go to the definition", it always bring me to the prototype in the header file. Normally, IAR presents me with either the prototype or the definition of the function and I need to click either the declaration or the prototype.

So it does shows me that for whatever reason, the file nrf_drv_spis.c doesn't seem to be in the project, but I don't know what to do to fix this.

Any help would be appreciated. Thanks.


Solution

  • So the issue here is that I missed that in another crucial header file, some definitions were behind a #ifdef and thus when compiling the code, the right files weren't included.

    Setting the right parameters made the code to compile correctly.