如何将库添加到Eclipse CDT管理的项目 [英] How to add libs to Eclipse CDT-managed projects

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

问题描述

我正在使用 Eclipse CDT插件来编写简单的C程序,并且我在文档中没有位置查找有关如何操作的信息:

I am using the Eclipse CDT plugin to write simple C programs, and no where in the documentation can I find info on how to:


  • 导入 C标准库,例如 assert.h 等。

  • 导入非标准第三方库,例如 glib ,甚至可能是我自己的本地库

  • Import C standard libraries such as assert.h, etc.
  • Import non-standard, 3rd party libraries, such as glib, or even perhaps my own local libraries

Java领域,要将jar / lib添加到项目的build / compile路径,一种解决方案是将jar复制到项目内的 lib / 目录中,右键单击它,然后转到 Build Path>>添加到构建路径我想知道CDT的C程序等效于什么吗?

In Java-land, to add a jar/lib to your project's build/compile path, one solution is to copy the jar into a lib/ directory inside the project, right-click it, and then go to Build Path >> Add to Build Path. I'm wondering what the equivalent is for C programs with CDT?

推荐答案

来自 http://wiki.eclipse.org/CDT/User/FAQ/How#do_I_add_an_external_library_to。 2B.2B_project.3F

对于包括:右键单击项目,然后转到属性 >> C / C ++构建>设置 >> GCC C ++编译器 >>包含

For includes: right click on your project and go to Properties>>C/C++ Build>>Settings>>GCC C++ Compiler >> Includes

您必须添加外部库(标头所在的位置)的包含路径。 Eclipse索引器(代码完成等)和编译器需要此信息。

you must add the include path for the external library (where the header reside). This information is needed by the Eclipse indexer (code completion etc.) and the compiler

对于库:右键单击您的项目,然后转到Properties >> C / C ++ Build。 >>设置>> GCC C ++链接器>>库,您必须添加库搜索路径(选项-L)和要链接的库(选项-l)。链接器需要此信息。

For libraries: right click on your project and go to Properties>>C/C++ Build>>Settings>>GCC C++ Linker >> Libraries you must add the library search path (option -L) and the library you want to link against (option -l). This info is needed for the linker.

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

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