如何将库添加到eclipse C项目中? [英] How to add a library to eclipse C project?

查看:541
本文介绍了如何将库添加到eclipse C项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Eclipse靛蓝中的C项目中添加一个C库。
我到目前为止做了什么
我已经下载并安装了库。
所有头文件在/ usr / include文件夹中,library.so文件位于/ usr / lib文件夹中。
阅读完教程后,我尝试这样做:
在Eclipse中 - > Project - > C / C ++ Build - > Settings - > GCC C Linker - > Libaries - > Add libary - > ibxml2(库名称为libxml2)
但它仍然不起作用。
我是一个超级新手在Linux,所以请你给我一些建议如何做到这一点?

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?

顺便说一句。创建新的C / C ++项目当我运行错误发生启动失败!二进制未找到。我在项目的设置中选中了二进制解析器,并设置了精灵解析器(我已经读过它对于Linux来说是可行的),那怎么了?这不是很重要,因为当我第一次只构建项目然后运行它时,它可以工作,但也许有办法解决这个问题?

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?

推荐答案

在链接器选项中,您不应该添加libxml2,而只能添加xml2。 Linux(所以文件)中的所有二进制库都有一个不是库名称的lib前缀。

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.

这篇关于如何将库添加到eclipse C项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆