What's the difference between the Build Path a

2019-02-13 16:01发布

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

标签: eclipse-pdt
2条回答
The star\"
2楼-- · 2019-02-13 16:36

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.

查看更多
老娘就宠你
3楼-- · 2019-02-13 16:40

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.

查看更多
登录 后发表回答