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

Build Errors with nRF examples - Undefined References

I am somewhat of a beginner - I have successfully built and programmed a "Hello World" example on the nRF5340. However I am having trouble building some of the Bluetooth samples in SES 4.52 (mac OS 10.14.6).

I seem to have issues with un-referenced functions. For example shown below - why is the compiler not seeing the "dk_buttons_and_leds.h" file? I have verified it is located at /Users/Samuel/sourcecode_root/ncs/nrf/include/dk_buttons_and_leds.h ?  I am also seeing similar errors with other bluetooth samples.

When I try to build the peripheral_lbs I get the following errors:

Building ?zephyr/zephyr_prebuilt.elf? from solution ?build? in configuration ?Common?
1> Compiling ?empty_file.c?
1> Linking ?zephyr_prebuilt.elf?
1> Memory region         Used Size  Region Size  %age Used
1>            FLASH:       95418 B         1 MB      9.10%
1>             SRAM:       21508 B       448 KB      4.69%
1>         IDT_LIST:          72 B         2 KB      3.52%
1> /opt/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `app_led_cb':
1> /Users/Samuel/sourcecode_root/ncs/nrf/samples/bluetooth/peripheral_lbs/build_nrf5340_dk_nrf5340_cpuapp/../src/main.c:157: undefined reference to `dk_set_led'
1> /opt/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `disconnected':
1> /Users/Samuel/sourcecode_root/ncs/nrf/samples/bluetooth/peripheral_lbs/build_nrf5340_dk_nrf5340_cpuapp/../src/main.c:68: undefined reference to `dk_set_led_off'
1> /opt/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `connected':
1> /Users/Samuel/sourcecode_root/ncs/nrf/samples/bluetooth/peripheral_lbs/build_nrf5340_dk_nrf5340_cpuapp/../src/main.c:61: undefined reference to `dk_set_led_on'
1> /opt/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `button_changed':
1> /Users/Samuel/sourcecode_root/ncs/nrf/samples/bluetooth/peripheral_lbs/build_nrf5340_dk_nrf5340_cpuapp/../src/main.c:173: undefined reference to `bt_gatt_lbs_send_button_state'
1> /opt/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `main':
1> /Users/Samuel/sourcecode_root/ncs/nrf/samples/bluetooth/peripheral_lbs/build_nrf5340_dk_nrf5340_cpuapp/../src/main.c:197: undefined reference to `dk_leds_init'
1> /opt/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `init_button':
1> /Users/Samuel/sourcecode_root/ncs/nrf/samples/bluetooth/peripheral_lbs/build_nrf5340_dk_nrf5340_cpuapp/../src/main.c:182: undefined reference to `dk_buttons_init'
1> /opt/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: app/libapp.a(main.c.obj): in function `main':
1> /Users/Samuel/sourcecode_root/ncs/nrf/samples/bluetooth/peripheral_lbs/build_nrf5340_dk_nrf5340_cpuapp/../src/main.c:226: undefined reference to `bt_gatt_lbs_init'
1> /opt/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /Users/Samuel/sourcecode_root/ncs/nrf/samples/bluetooth/peripheral_lbs/build_nrf5340_dk_nrf5340_cpuapp/../src/main.c:242: undefined reference to `dk_set_led'
1> collect2: error: ld returned 1 exit status
Build failed



Parents
  • Hi.

    The samples should build without a problem if they have not been modified and the toolchain has been installed correctly.

    When you installed the toolchain, did you follow the Getting Started Assistant application in nRF Connect for Desktop?

    Could you try to run "git status" inside the "nrf" folder?

    Is CONFIG_BT_GATT_LBS and CONFIG_DK_LIBRARY set in the prj.conf file?

    Best regards,

    Didrik

Reply
  • Hi.

    The samples should build without a problem if they have not been modified and the toolchain has been installed correctly.

    When you installed the toolchain, did you follow the Getting Started Assistant application in nRF Connect for Desktop?

    Could you try to run "git status" inside the "nrf" folder?

    Is CONFIG_BT_GATT_LBS and CONFIG_DK_LIBRARY set in the prj.conf file?

    Best regards,

    Didrik

Children
No Data
Related