33
votes

In Delphi, I can include a folder's source code by adding it to the project Search Path, or adding it to the Library Path. The Search Path applies only to the current project, while the Library Path applies to any project opened with the IDE.

Other than that, is there any functional difference between the Search and Library paths?

My reason for asking: I have a folder X with source used by project A. When I include that folder under Project A's search path, it says it cannot find a specific file in that folder. When I include it under the Library path, then project A compiles fine.

Until now, I was always under the impression that the only difference was that one was project-specific, and the other was global.

While we're on the topic (and at the risk of making a fool of myself): What is the functional difference between "library path" and "browsing path"?

2
you say "When I include that folder under Project A's search path, it says it cannot find a specific file in that folder." That is really the issue pointed here: It should find it. Have you checked that the Search path set with your folder meets your current Target Platform and Build Configuration?Didier Cabalé

2 Answers

31
votes

As far as I know, browsing path is where the debugger should look for files when breaking/stepping into source files thats not in the library path.

Lets say that you have a thirdparty component that you use. You point the library path to the directory where the pre-compiled dcu-files of that component are. Your project will use these dcu-files when you compile. This is good, because it wont be recompiled every time you do a build.

But by including the compiled dcu files, you loose the possibility to debug the thirparty component. If you include the path to where the source files are in the browse path, the debugger will find the source, and allow you to step in to it.

The default settings for the vcl show this. In library path they have put $(BSD)\Lib, and in the browsing path they have put $(BDS)\SOURCE\WIN32...

Update: There are two different kind of search paths: Compiler search path and debugger search path. The first is there the compiler looks for files during compiling, and the second is where the debugger looks for source files during debugging.

The compiler will only find files in the Library path or the projects search path. The debugger will find identifiers in the compilers search path plus the browsing path, the debug source path for the project, and the global debug search path.

There should not be any difference in specifying things globally or pr project.

1
votes

Debugger will also find files in Library Path.