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?
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?
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:
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
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:
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