Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a library to eclipse C project?

Tags:

c

linux

eclipse

I need to add a C library to C project in Eclipse indigo. What I've done so far. I've downloaded and installed the library. All headers are in folder /usr/include, library.so files are in folder /usr/lib. After having read a tutorial I tried to do it like this: When in Eclipse -> Project -> C/C++ Build -> Settings -> GCC C Linker -> Libaries -> Add libary -> "ibxml2" ( library name is libxml2 ) But it still doesn't work. I am a super newbie at Linux, so please could you give me some advise how to do that? there is a screenshot, that might be helpfful

By the way one more thing. After creating a new C/C++ Project when I run an error occurs " Launch failed! Binary not found". I checked "Binary Parsers" in Project's Settings and "Elf Parser" is set ( I've read that it is OK for Linux ), so what is wrong? It is not so important, since it works when I first only build project and then run it, but maybe there is a way to solve that too?

like image 832
koleS Avatar asked Oct 24 '22 16:10

koleS


1 Answers

In linker options, you should not add "libxml2", but just "xml2". All binary libraries in Linux (so files) have a "lib" prefix that is not a part of library name.

like image 176
ghik Avatar answered Oct 26 '22 23:10

ghik