issue in adding external library

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

issue in adding external library

4,576 Views
anshun
Contributor II

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:

  1. Add lib folder and .a library to the project workspace

anshun_0-1632455004232.png

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)

anshun_1-1632455004257.png

kindly help.

Thanks 

 

0 Kudos
Reply
11 Replies

4,569 Views
ErichStyger
Specialist I

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

0 Kudos
Reply

4,544 Views
anshun
Contributor II

 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,

0 Kudos
Reply

4,540 Views
ErichStyger
Specialist I

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

0 Kudos
Reply

4,537 Views
anshun
Contributor II

Ok, Thank you

0 Kudos
Reply

4,573 Views
KalaimaniArumugam
Contributor III
0 Kudos
Reply

4,556 Views
anshun
Contributor II

this link is not opening

 

0 Kudos
Reply

4,553 Views
ErichStyger
Specialist I
0 Kudos
Reply

4,543 Views
anshun
Contributor II

.a file is already there but how to make it compatible with the ide i am using ?

0 Kudos
Reply

4,518 Views
converse
Senior Contributor V

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?

0 Kudos
Reply

4,491 Views
anshun
Contributor II

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.

0 Kudos
Reply

4,483 Views
ErichStyger
Specialist I

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

0 Kudos
Reply