issue in adding external library

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

issue in adding external library

4,547件の閲覧回数
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 件の賞賛
返信
11 返答(返信)

4,540件の閲覧回数
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 件の賞賛
返信

4,515件の閲覧回数
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 件の賞賛
返信

4,511件の閲覧回数
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 件の賞賛
返信

4,508件の閲覧回数
anshun
Contributor II

Ok, Thank you

0 件の賞賛
返信

4,544件の閲覧回数
KalaimaniArumugam
Contributor III
0 件の賞賛
返信

4,527件の閲覧回数
anshun
Contributor II

this link is not opening

 

0 件の賞賛
返信

4,524件の閲覧回数
ErichStyger
Specialist I
0 件の賞賛
返信

4,514件の閲覧回数
anshun
Contributor II

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

0 件の賞賛
返信

4,489件の閲覧回数
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 件の賞賛
返信

4,462件の閲覧回数
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 件の賞賛
返信

4,454件の閲覧回数
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 件の賞賛
返信