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

Multiple definition error in app_uart_fifo

Hi

I combined ble_app_uart with relay example .I am getting a multiple definition error in app_uart_fifo while building.I have added required .c files and their header paths and also compared the sdk config file of uart example with relay example.Please let me know if I am missing something.Find below the attached screenshot.

Thank you

Parents
  • Building ‘ble_app_hrs_rscs_relay_pca10040_s132’ from solution ‘ble_app_hrs_rscs_relay_pca10040_s132’ in configuration ‘Release’
      
      
      Linking ble_app_hrs_rscs_relay_pca10040_s132.elf
      
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_init':
        multiple definition of `app_uart_init'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:85: first defined here
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_flush':
        multiple definition of `app_uart_flush'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:153: first defined here
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_get':
        multiple definition of `app_uart_get'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:120: first defined here
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_put':
        multiple definition of `app_uart_put'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:133: first defined here
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_close':
        multiple definition of `app_uart_close'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:156: first defined here
    Build failed

Reply
  • Building ‘ble_app_hrs_rscs_relay_pca10040_s132’ from solution ‘ble_app_hrs_rscs_relay_pca10040_s132’ in configuration ‘Release’
      
      
      Linking ble_app_hrs_rscs_relay_pca10040_s132.elf
      
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_init':
        multiple definition of `app_uart_init'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:85: first defined here
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_flush':
        multiple definition of `app_uart_flush'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:153: first defined here
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_get':
        multiple definition of `app_uart_get'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:120: first defined here
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_put':
        multiple definition of `app_uart_put'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:133: first defined here
      
        Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_close':
        multiple definition of `app_uart_close'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:156: first defined here
    Build failed

Children
  • So let's take just the first one:

      Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart_fifo.o: in function `app_uart_init':
      multiple definition of `app_uart_init'; Output/ble_app_hrs_rscs_relay_pca10040_s132 Release/Obj/app_uart.o:C:\Users\admin\Desktop\nRF5_SDK_15.3.0_59ac345\components\libraries\uart/app_uart.c:85: first defined here
      

    It tells you that you have multiple definitions of `app_uart_init';

    It tells you that in the file app_uart_fifo.o - which is the object file generated by compiling app_uart_fifo.c

    It tells you that the first definition was in app_uart.o - which is the object file generated by compiling app_uart.c

    So you need to decide whether to keep the one from app_uart_fifo.c or the one from app_uart.c

    The rest will be similar.

    Again, standard 'C' stuff.

Related