This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Compiling Error

Hello, I have combined two files spi_master and ble_app_uart into one file. Once trying to compile main.c compiles with no error but bsp.c compiles with 3 errors although I have added the master.h library to it. It seems there is a problem with the linker linking two files but I couldn't resolve the problem. The error I get is bellow and you can also see the image I attach. Any help would be greatly appreciated.

.\_build\nrf51422_xxac_s110.axf: Undefined symbol spi_master_evt_handler_reg (referred from main.o).

image description

Parents
  • What you are seeing is not a compiler error, but a linker error. The linker complains about a usage of the function spi_master_evt_handler_reg() in main.c but the linker can find that function in any of object and library files given.

    You should check that you’ve defined (aka implemented) spi_master_evt_handler_reg() somewhere and that this file is compiled and linked into the final executable. Maybe your IDE allows you to see, how the linker is invoked. Sometime the order in which files are given to the linker matters, but this depends on the tools you are using.

Reply
  • What you are seeing is not a compiler error, but a linker error. The linker complains about a usage of the function spi_master_evt_handler_reg() in main.c but the linker can find that function in any of object and library files given.

    You should check that you’ve defined (aka implemented) spi_master_evt_handler_reg() somewhere and that this file is compiled and linked into the final executable. Maybe your IDE allows you to see, how the linker is invoked. Sometime the order in which files are given to the linker matters, but this depends on the tools you are using.

Children
No Data
Related