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

Error: Undefined reference when using ble_app_uart

Hi everyone
I have an error undefined reference when I try to run esb_ble timeslot program based on the ble_app_uart example. Although, I totally added all files in Project and User include directory like a picture I attatch below but it still has these errors. I'm really confused and don't know how to fix it. Please help me tackle this problem. Thank you so much !!!

P/s: The original file is ble_app_uart and I replace a main code, add some initial files. Besides that I also tried to change the sdk_config.h value but no hope.

  • Hello,

    Although, I totally added all files in Project and User include directory like a picture I attatch below but it still has these errors. I'm really confused and don't know how to fix it.

    It seems to me that the init.c source file is found, but the functions called from the init.c file is not found by the linker.
    Are you calling the functions pm_init and fds_gc in your source files? If so, could you ensure that these files correctly link to the peer manager and fds headers?

    This might seem trivial, but could you confirm for me that the location of your source files ( like init.c ) is actually $SDK_ROOT/components/GC_source?
    Could you also confirm for me that you do not have a trailing white space behind any of your include paths?

    I would also recommend that you do not place components for your project in between other SDK files/directories/components. Rather, you should create these directory within your project directory, in order to more easily distinguish between your own code, modified SDK code and original SDK code. This will also drastically increase readability for other engineers that look into your project, if they are already familiar with the SDK. All in all, it saves a lot of trouble down the line, and is considered a best practice.

    Looking forward to resolving this issue together,

    Best regards,
    Karl

  • Hi Karl Ylvisaker
    Thank you so much for replying my question. 

    Are you calling the functions pm_init and fds_gc in your source files?

     Yes, I'm calling it in main source code

    If so, could you ensure that these files correctly link to the peer manager and fds headers?

    Yes, because when I press right click and choose Go to Declaration in pm_init and fds_gc, it will launch to peer_manager.h and fds.h

    could you confirm for me that the location of your source files ( like init.c ) is actually $SDK_ROOT/components/GC_source?

    It located in $SDK_ROOT/components/GC_source because I attached it. 

    Could you also confirm for me that you do not have a trailing white space behind any of your include paths?

    Yes, no a trailing white space

    I would also recommend that you do not place components for your project in between other SDK files/directories/components

    That's my concern because all files I've attached come from nRF51 SDK example and I've currently used nRF52 SDK  

  • Eric Nguyen said:
    Thank you so much for replying my question. 

    It is no problem at all, I am happy to help!

    Eric Nguyen said:
    It located in $SDK_ROOT/components/GC_source because I attached it. 
    Eric Nguyen said:
    Yes, no a trailing white space
    Eric Nguyen said:
    Yes, I'm calling it in main source code

    Thank you for clarifying these things.

    Eric Nguyen said:
    That's my concern because all files I've attached come from nRF51 SDK example and I've currently used nRF52 SDK

    Do I understand you correctly that the files you are attaching comes from an earlier SDK, and thus you would like their placement to be the same?
    I would still recommend that you move them to your project folder, since you are now creating a project using the SDK v.17.0.2. This will make things easier on the long term.

    Could you possibly move the added source files to the project folder, change the added paths, and see if it runs then?
    Could you also change the last forward slash to a backslash in your path to match the rest of the path?

    If it still does not find it, would it be possible for you to send a zipped version of the project to me, so I could take a look at it myself? It is difficult to understand the layout and placement of the files without seeing the project.

    Looking forward to resolving this issue together!

    Best regards,
    Karl

Related