Eclipse PDT 中的构建路径和包含路径有什么区别?
Eclipse PDT 中的构建路径和包含路径有什么区别?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Eclipse PDT 中的构建路径和包含路径有什么区别?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
简短的回答:保持两者上的源文件夹列表相同(默认情况下 Eclipse 会帮助您这样做)。
更长的答案:
简单/直接的部分:Eclipse PDT 中的 包含路径 设置是启动项目时用作包含路径的路径/项目/库列表(例如作为 PHP CLI 应用程序)来自日食。
包含路径还部分(见下文)用于内容辅助(也称为代码完成)。 例如,如果您的包含路径设置中有一些外部库或链接的项目,那么您将在这些资源的函数和类上获得内容辅助、文档弹出窗口等。
对于包含路径的“源”选项卡上的项目来说,情况并不完全正确。 仅考虑运行时包含路径(从 Eclipse 启动应用程序时)以及
include
和require
PHP 语句上的内容辅助。为了让所有其他方便的东西也能工作(正常 PHP 代码中的内容辅助、文档弹出窗口、点击,...),您必须在构建路径下定义这些源(也)。
据我了解,构建路径是 PDT 2.0 中包含路径的源项目的“分支”(请参阅 http://www.eclipse.org/pdt/release-notes/pdt2_0.php) 作为优化功能,以加快构建过程。
因此,除非您正在处理具有构建速度问题的复杂/大型项目,否则保持构建上的源项目和包含路径相同可能是最好的/最不令人困惑的。
Short answer: keep the list of source folders on both the same (as Eclipse will helpfully do for you by default).
Longer answer:
The easy/straightforward part: the include path settings in Eclipse PDT is the list of paths/projects/libraries that will be used as include path when launching your project (e.g. as PHP CLI app) from Eclipse.
The include path is also partially (see below) used for content assist (aka code completion). For example, if you have some external libraries or a linked project in your include path settings, you will have content assist, documentation popups, etc on functions and classes from these resources.
This is not completely true for items on the "source" tab of the include path. These are only considered for the runtime include path (when launching your app from eclipse) and content assist on
include
andrequire
PHP statements.For all the other handy stuff to work as well (content assist in normal PHP code, doc popups, clicking through, ...) you have to define these sources under the build path (as well).
As far as I understand, the build path is a "fork" of the source items of the include path in PDT 2.0 (see http://www.eclipse.org/pdt/release-notes/pdt2_0.php) as an optimization feature, to allow speeding up the build process.
So unless you are working on a complex/large project with build speed issues, it's probably the best/least confusing to keep the source items on build and include path the same.
构建路径是一组路径,IDE 将使用它来解析代码、显示错误、返回自动完成方法等。
包含路径是类似于 PHP 执行配置的包含路径的路径。
如果您有应该执行的代码,但您不想在 IDE 中看到全部内容,则可以仅在包含路径中定义它。
当然,在执行/调试过程中,构建路径中定义的所有路径都会自动添加到包含路径中,在这种情况下,构建路径将被追加到包含路径中。
Build path is a set of paths, that IDE will use in order to parse the code, show errors, return auto completions methods, etc...
Include path is a path that similar to include path of the PHP execution configuration.
If you have a code that should be executed, but you don't want to see it all in IDE, you can define it in include path only.
Of course, all the paths defined in build paths will be added to include path automatically during the execution/debugging, in this case, the build path will be appended to the include path.