What's the difference between the Build Path and the Include Path in Eclipse PDT?

为君一笑 提交于 2019-11-29 19:13:09

问题


What's the difference between the Build Path and the Include Path in Eclipse PDT?


回答1:


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 and require 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.




回答2:


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 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 defined it in include path only.

Of cause, all the paths defined in build paths will be added to include path automatically during execution/debugging, in other words, build path is an include path.



来源:https://stackoverflow.com/questions/981956/whats-the-difference-between-the-build-path-and-the-include-path-in-eclipse-pdt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!