在Eclipse-CDT中使用* relative *路径引用第三方库 [英] Referencing 3rd party Libraries using *relative* paths in Eclipse-CDT

查看:599
本文介绍了在Eclipse-CDT中使用* relative *路径引用第三方库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse-CDT中使用相对路径引用第三方C ++组件(例如include,库)的最佳做法是什么?

what is the best practice to reference 3rd party C++ components (e.g. includes, libraries) using relative paths in Eclipse-CDT?


  • 我试图引用Boost和Google protobuf。

  • 我把它们放在我的工作空间的一个文件夹中,例如/ home / user / workspace / boost_1_39_9

  • 我在项目属性中的build设置下添加了对该文件夹的引用,但eclipse不会让我指定相对于工作区文件夹,我必须使用文件系统选择它并指定绝对路径

谢谢,


  • Alex

推荐答案

因为$ {workspace_loc}和$ {project_loc}仅适用于运行时Eclipse工作区中实际 的东西。当你说你将它们放在文件系统中的工作区下时,你是否真的将文件导入到Eclipse中(使用新项目;或者在现有项目中创建链接文件夹)?

Eclipse variables, such as ${workspace_loc} and ${project_loc} only work for things that are actually in the runtime Eclipse workspace. When you say you put them under the workspace in the filesystem, did you actually import the files into Eclipse (using new Project; or creating a linked folder in an existing project)?

如果文件存在于文件系统中但不在Eclipse本身中,则Eclipse将只能使用绝对路径访问它们。

If the files exist in the filesystem but not in Eclipse itself then Eclipse will only be able to access them with absolute paths.

BTW,CDT有自己的变量:$ {WorkspaceDirPath} $ {ProjDirPath} $ {ProjName},扩展到特定的文件系统位置。

BTW, CDT has variables of its own: ${WorkspaceDirPath} ${ProjDirPath} ${ProjName} which expand to the particular filesystem location.

这篇关于在Eclipse-CDT中使用* relative *路径引用第三方库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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