Eclipse PDT中的构建路径和包含路径之间有什么区别?

时间:2023-01-17 19:11:45

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

Eclipse PDT中的构建路径和包含路径之间有什么区别?

2 个解决方案

#1


Short answer: keep the list of source folders on both the same (as Eclipse will helpfully do for you by default).

简短回答:保持源文件夹列表都相同(默认情况下Eclipse将帮助您)。

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.

简单/直接的部分:Eclipse PDT中的包含路径设置是从Eclipse启动项目(例如,作为PHP CLI应用程序)时将用作包含路径的路径/项目/库的列表。

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.

对于包含路径的“源”选项卡上的项目,这不完全正确。这些只考虑运行时包含路径(从eclipse启动应用程序时)和内容辅助包含和需要PHP语句。

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).

对于所有其他方便的东西也可以工作(内容辅助正常的PHP代码,doc弹出窗口,点击,......)你必须在构建路径下定义这些源(以及)。

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.

据我所知,构建路径是PDT 2.0中包含路径的源项的“分支”(参见http://www.eclipse.org/pdt/release-notes/pdt2_0.php)作为优化功能,以加快构建过程。

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

构建路径是一组路径,IDE将使用这些路径来解析代码,显示错误,返回自动完成方法等...

Include path is a path that similar to include path of php execution configuration.

包含路径是类似于包含php执行配置路径的路径。

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.

如果您有一个应该执行的代码,但您不希望在IDE中看到它,则可以仅在include路径中定义它。

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.

当然,构建路径中定义的所有路径都将在执行/调试期间自动添加到包含路径,换句话说,构建路径是包含路径。

#1


Short answer: keep the list of source folders on both the same (as Eclipse will helpfully do for you by default).

简短回答:保持源文件夹列表都相同(默认情况下Eclipse将帮助您)。

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.

简单/直接的部分:Eclipse PDT中的包含路径设置是从Eclipse启动项目(例如,作为PHP CLI应用程序)时将用作包含路径的路径/项目/库的列表。

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.

对于包含路径的“源”选项卡上的项目,这不完全正确。这些只考虑运行时包含路径(从eclipse启动应用程序时)和内容辅助包含和需要PHP语句。

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).

对于所有其他方便的东西也可以工作(内容辅助正常的PHP代码,doc弹出窗口,点击,......)你必须在构建路径下定义这些源(以及)。

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.

据我所知,构建路径是PDT 2.0中包含路径的源项的“分支”(参见http://www.eclipse.org/pdt/release-notes/pdt2_0.php)作为优化功能,以加快构建过程。

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

构建路径是一组路径,IDE将使用这些路径来解析代码,显示错误,返回自动完成方法等...

Include path is a path that similar to include path of php execution configuration.

包含路径是类似于包含php执行配置路径的路径。

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.

如果您有一个应该执行的代码,但您不希望在IDE中看到它,则可以仅在include路径中定义它。

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.

当然,构建路径中定义的所有路径都将在执行/调试期间自动添加到包含路径,换句话说,构建路径是包含路径。