Eclipse CDT的:如何引用第三方通过一个相对路径包括 [英] Eclipse CDT: How to reference 3rd party includes via a Relative path

查看:425
本文介绍了Eclipse CDT的:如何引用第三方通过一个相对路径包括的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Eclipse的CDT,建立了第一次一个新的项目。我想引用升压的没有的硬编码的绝对路径。

I'm new to Eclipse-CDT, setting up a new project for the first time. I'm trying to reference Boost without hardcoding an absolute path.

我已经把提升我的工作区文件夹,例如/ home / user中/工作区/ boost_1_39_0

I've put boost in my workspace folder, e.g. /home/user/workspace/boost_1_39_0

我当时希望能增加一个include目录指向相对于工作区文件夹,但Eclipse将不会做到这一点,它似乎只是想指出认为在/ home /用户/工作区/ [MyProjectNameHere]

I was then hoping to add an include directory pointing to that folder relative to the workspace, but Eclipse won't do that, it seems to only want to point to thinks in /home/user/workspace/[MyProjectNameHere]

任何提示吗?它似乎没有意义的提升复制到我的项目文件夹,因为那在Eclipse中显示出来和Eclipse要构建它​​(当然,我的可能的排除)。

Any tips? It doesn't seem to make sense to copy Boost into my project folder, because then it shows up in Eclipse and Eclipse wants to build it (sure, I could exclude it).


  • 亚历

推荐答案

在添加了CDT项目(项目属性/ C / C ++通用/路径和符号),一个包含文件的路径,有3个按钮来浏览位置

When adding an include file path in the CDT project (Project Properties/C/C++ General/Paths and Symbols), there are 3 buttons to browse for a location:


  • 变量...

  • 工作区...

  • 文件系统...

如果您preSS工作区...按钮,路径将是相对于工作空间/项目。如果选择变量...按钮,您将获得合并的变量,如 $ {WorkspaceDirPath} 。该变量也可以引用环境变量,如果你想要一个安装提振从可能的任何位置。您的机器上项目引用的这可能是得心应手。

If you press the Workspace... button, the path will be relative to the workspace/project. If you select the Variables... button, you'll get to incorporate variables such as ${WorkspaceDirPath}. The variables can also reference environment variables, which might be handy if you want a single install of boost to be referenced from projects that might reside anywhere on your machine.

如果您合并变量到路径,确保是一个工作空间的路径选项被选中 - 否则变量似乎当你preSSOK,而不是呆在一个变量在构建进行评估,以得到评估时间。

If you incorporate variables into the path, make sure the "Is a workspace path" option is checked - otherwise the variable seems to get evaluated when you press "OK" instead of staying a variable to be evaluated at build time.

这篇关于Eclipse CDT的:如何引用第三方通过一个相对路径包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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