I want to add an external library in my project but getting the error as" error adding symbols, file format not recognized" I have followed the below steps:
2.Make sure you only specify library_name. in the project settings
For example, if you have a library called libmyxml.a, you will specify myxml in the Linker Libraries settings.
Note that you will also need to specify the location that you have placed the library archive in the Library search path (-L) setting
3. Add the lib to Project -> Properties -> C/C++ Build -> Settings -> Tool Settings
-> MCU Linker -> Libraries -> Libraries (-l)
kindly help.
Thanks
Are you sure the library has been compiled for the MCU you are using?
It seems that the content is not compatible with what you have.
I hope this helps,
Erich
the library which i have contains the header file and .a file.
I tried to compile it in a separate project and get another .a file.
But when i use the APIs of this library in main project, it shows undefined reference,
The archive (.a) is basically a collection of compiled object (ELF/Dwarf) files. The library needs to be compiled for your target (same processor) and be compatible with the toolchain used (e.g. GCC, memory model, EABI used, etc).
Ideally you have all the source files to build that .a file. If not, you need to contact the vendor/provider of that .a file.
Erich
Ok, Thank you
anshun
You try this method its woks fine for me
https://mcuoneclipse.com/2013/02/12/creating-and-using-libraries-with-arm-gcc-and-eclipse/
this link is not opening
.a file is already there but how to make it compatible with the ide i am using ?
Where did you get the library from? From your description, I suspect that you did not get the correct ARM version of the library. Did you get the x86 version? Or perhaps a version for ARM Linux?
Yes, i got x86 version.
when i build my project just by adding the library it gets build. But when I call those APIs it shows undefined reference error.
You cannot link an ARM binary with a binary/archive/library compiled for x86. It simply cannot work. You will need a library built for the same ARM architecture.
I hope this helps,
Erich