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

2

10

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

Sisyphean answered 11/6, 2009 at 15:52 Comment(0)
E
7

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.

Eskill answered 9/11, 2012 at 22:27 Comment(2)
The best answer especially because it highlights the fact that folders put in the "Source" tab are not indeed available for content assist, which is quite in contrast with the behaviour of the Libraries and Projects tabs and generates confusion when reading the PDT online help.Barrage
@MauroMolinari I just landed on this SO page after having been reading eclipse.org/forums/index.php/t/171385 :)Optometry
M
4

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.

Mcmichael answered 6/10, 2009 at 19:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.