Sign in Join
Wiki copytemporary

IDE Window: Unit info: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11The **Unit information dialog** as available from the menu \[Source\|Unit information\] shows various information of the current file in the source editor.
22
33## General
44
55![](/wiki-images/c/c4/Unit_Info_General_2_0_10.jpg)
66
77- Name: the unit name as written in the source code. Otherwise it is the filename without the extension and path.
88- Type: The highlighter type. This can be changed via the popup context menu in the source editor.
99- In Project: Displays if the file is part of the current project. This can be changed in the [[IDE Window: Project Inspector]] or the [[Main menu|Main Menu]] \> [[Main menu|Project]] \> Add to Editor File to Project or Remove from Project menu items.
1010- Size: The size of the file in bytes
1111- Lines: The number of source code lines.
1212- Path: Full file pathname.
1313- Included by: This file was included last time by this source file. For example via an {\$I filename.inc} include directive. This is automatically set each time the IDE parses the unit containing the include directive. You can clear this with the Clear button. You can use Search -\> Goto include directive to jump to the include directive of the parent file.
1414- Clear include cache: This button clears the 'Included by'.
1515
1616## Unit paths
1717
1818![](/wiki-images/5/5c/Unit_Info_Unit_Paths_2_0_10.jpg)
1919
2020These are the unit paths used by the IDE for this file. The unit paths are used to search for .ppu, .pas, .pp, .p files. Normally these paths are given to the compiler, but there are cases where this is not the case and it does not show the unit paths defined in the compiler configuration file (`fpc.cfg`).
2121
2222These paths are created by the rules in the Tools -\> Options -\> CodeTools defines editor. All files in a directory share the same search paths (unit paths, include paths, ...). If this a project directory, all project unit paths are added. If the directory belongs to a package its unit paths will be added. If you put a project and a package into one directory, both paths will be added. That it why it is recommended to give packages and projects directories of their own.
2323
2424Difference between compiler search paths and IDE search paths:
2525
2626Normally the difference does not matter. The compiler is invoked in one directory with a set of search paths. For example: There are 4 packages:
2727
28-` /home/user/package1/package1.lpk`\
29-` /home/user/package2/package2.lpk`\
30-` /home/user/package3/package3.lpk using package1 and package2`\
31-` /home/user/package4/package4.lpk using package1 and package2`
28+```text
29+ /home/user/package1/package1.lpk
30+ /home/user/package2/package2.lpk
31+ /home/user/package3/package3.lpk using package1 and package2
32+ /home/user/package4/package4.lpk using package1 and package2
33+```
3234
3335When package3 is compiled in /home/user/package3 with unit path /home/user/package1/;/home/user/package2/. When the compiler finds a unit in /home/user/package2/ and compiles it it applies all unit paths, including path to /home/user/package3/. This is normally unwanted and therefore a standard package defines an output directory. But for this example we assume the package compiles it .ppu files into the source directory.
3436
3537When the compiler is invoked for package4 it will be started in a different directory with different search paths. Here it is invoked in /home/user/package4 with unit path /home/user/package1/;/home/user/package2/. When the compiler finds a unit in /home/user/package2/ and compiles it it applies all unit paths, including the path to package4. This means the compiler compiles the units in package2 with two different unit paths. This is normally a bad idea as the result depends on the order - if you compile first package3 then package4 or the other way round. But in real world (e.g. the Delphi world) this is more common than one would expect. It is clear, that if packages contain the units with the same name the order of the file paths in the search paths becomes important.
3638
3739The IDE solves this by collecting search paths for every directory. That means, for example,the search paths for the Lazarus sources have their own unit paths and do not include the unit paths to your project. A directory, that is not part of your project, does not include the unit paths of your project. This way you can browse Delphi VCL sources and Lazarus LCL sources both containing units with same names.
3840
3941## Include paths
4042
4143![](/wiki-images/d/d0/Unit_Info_Include_Paths_2_0_10.jpg)
4244
4345Same as unit paths, but for the include paths. Search paths for include directives\
4446`{$I filename.inc}` or `{$INCLUDE filename.inc}`.
4547
4648 
4749
4850## Source paths
4951
5052![](/wiki-images/0/0b/Unit_Info_Source_Paths_2_0_10.jpg)
5153
5254This is the unit path plus the compiled source paths.
5355
5456For example:
5557
56-` /home/user/project`\
57-` /home/user/package/lib`
58+```text
59+ /home/user/project
60+ /home/user/package/lib
61+```
5862
5963The project uses the package. The package source files are in /home/user/package and the output files (.ppu) of the package are put in /home/user/package/lib.
6064
6165The unit path of the project will contain the path to the output directory of the package - /home/user/package/lib. So when the compiler is invoked to compile the project it finds the .ppu files of the package, but not the source (.pas) of the package. This way it can not recompile the package, which is good, because the compiler options of the project are probably different than for the package. The IDE should find the source files (.pas). It knows, that /home/user/package/lib is the output directory of the package, so it adds the unit path of the package to the source path of the project. This addition is called the compiled source path.
6266
6367 
6468
6569## Show CodeTools Values
6670
6771See [[IDE Window: Codetools Directory Values|Codetools Directory Values]]
6872
6973## OK
7074
7175The `OK` button dismisses the dialog.
7276
7377---
7478*From the Free Pascal wiki, page "IDE Window: Unit info", as it stood on 2021-02-01 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history