如何添加库蚀C ++项目? [英] How to add a library to eclipse C project?

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

问题描述

我需要在Eclipse靛蓝添加一个C库到C项目。
我到目前为止已经完成。
我已经下载并安装该库。
所有的头是在文件夹/ usr / include目录,library.so文件夹中的/ usr / lib目录。
看了教程后,我试图做这样的:
当在Eclipse - >项目 - > C / C ++编译 - >设置 - > GCCÇ链接器 - > Libaries - >添加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二进制库(.so文件)有一个lib目录preFIX不是库名称的一部分。

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.

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

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