Specifying libraries

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Specifying libraries

954 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdupre on Wed Jan 22 10:22:50 MST 2014
By default, when LPCXpresso generates a static library, the output filename is prefixed with "lib".  That is, library project "my_library" will have an output file of "libmy_library.a"

However when specifying the library in another project (via Properties| C/C++ Build|Settings|MCU Linker|Libraries) you should NOT include the "lib" prefix in the library name.  If you do, you'll get this:
c:/nxp/lpcxpresso_6.1.0_164/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/bin/ld.exe: cannot find -llibmy_library

Also, if you do not add the "lib" prefix to the library name the linker can not find the library. Why the naming inconsistency?  Is this a GCC quirk?
0 Kudos
Reply
2 Replies

945 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Thu Jan 23 01:52:22 MST 2014

Quote: jdupre
Why the naming inconsistency?  Is this a GCC quirk


No, this is standard Unix ld behavior since the beginning.

http://man.cat-v.org/unix-1st/1/ld
0 Kudos
Reply

945 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jan 23 01:24:55 MST 2014
This is standard GCC behaviour

From the GCC linker docs included in the LPCXpresso built in help, or online in various places such as:
http://sourceware.org/binutils/docs-2.21/ld/Options.html#Options


Quote:
-l namespec
--library=namespec
Add the archive or object file specified by namespec to the list of files to link. This option may be used any number of times. If namespec is of the form :filename, ld will search the library path for a file called filename, otherwise it will search the library path for a file called libnamespec.a.



And for general information on using your own libraries in LPCXpresso see:
http://www.lpcware.com/content/faq/lpcxpresso/creating-linking-library-projects

Regards,
LPCXpresso Support
0 Kudos
Reply