issue in adding external library

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

issue in adding external library

4,548 次查看
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,541 次查看
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,516 次查看
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,512 次查看
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,509 次查看
anshun
Contributor II

Ok, Thank you

0 项奖励
回复

4,545 次查看
KalaimaniArumugam
Contributor III
0 项奖励
回复

4,528 次查看
anshun
Contributor II

this link is not opening

 

0 项奖励
回复

4,525 次查看
ErichStyger
Specialist I
0 项奖励
回复

4,515 次查看
anshun
Contributor II

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

0 项奖励
回复

4,490 次查看
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,463 次查看
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,455 次查看
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 项奖励
回复