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

Linking ESB library in Eclipse

I've tried linking the ESB library (esb_arm.lib) in Eclipse by adding it to my nRF51822 project's Makefile, but I am still getting undefined reference errors during build. Is there something special that needs to be done to include this library?

  • Hi,

    i have Problems when compiling the ESB example on eclipse.

    I got the following error:

    cannot find -lC:/eclipse-standard-kepler-SR2-win32/workspace/esb_rx/esb_gcc.a collect2.exe: error: ld returned 1 exit Status

    What can i do?

    Thanks

  • I had been fighting with this for a long time in Eclipse on Windows when porting an example that used nfc_t2t_lib_gcc.a, but I believe this resolution applies to other platforms and libraries. Compilation worked but I would receive Linker error: cannot find -l ....

    Here is what I found.

    GENERAL -l (lowercase l) .... is where you put the name of your library. If your library path is c:\yada\project\libABC.a then your -l is ABC. -l is reserved for the library without the path. It's really important (as noted in the link at the bottom of this response) that -l adds "lib" to the front of the library name and ".a" to the end of the library name. So, in the case of my example with nfc_t2t_lib_gcc.a, I actually needed to change the name of the file to libnfc_t2t_lib_gcc.a in order to use it with -l.

    -L (upper case L).... is where you put the path to your library. If your library path is **c:\yada\project\nfc_t2t_lib_gcc.a then your -L is c:/yada/project. -L is reserved for the path. Notice we use forward slashes.

    IN ECLIPSE Seems like different versions and set ups work differently but here are the locations in mine:

    1. Project Properties > C/C++ Build > Settings > CGNU ARM Cross Linker > Libraries.
    2. Add the library name (without the "lib" prefix and ".a" extension, e.g. "ABC" if file name is libABC.a)
    3. Add the path as explained above.

    THE MISSING INFO Getting this nugget from the dead sea scrolls of linker documentation is what solved my problem after many hours. gcc.gnu.org/.../Link-Options.html

Related