[Lazarus] Bug on CodeTools to find unit using in `../path/unit.pas`

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Dec 8 19:48:59 CET 2018

On Sat, 8 Dec 2018 14:15:20 -0200
"Marcos Douglas B. Santos via lazarus" <lazarus at lists.lazarus-ide.org>

> Hi,
> I'm playing around with units to include them in a "different" way in
> a test program. I realized that there are some issues only on Lazarus
> IDE code-completion — no error to compile.
> Inside the folder of the project, I've added a new unit in `msg`
> folder: `msg/msg.pas`.
> If I use this unit on lpr using `in`, like this:
> ===begin===
> program1;
> uses
>   {...},
>   `msg in 'msg/msg.pas'`;
> ===end===
> ...I have no issues to compile.
> Pay attention that I haven't put `msg` folder on Search Path.
> Inside on `msg` unit I have a code for testing:
> function MakeString: string;
> If uses that unit in any units on that program and try to
> code-complete "MakeS*" (Ctrl+SPACE) I got "Error: unit not found:
> msg" from CodeTools.
> Lazarus 1.9.0 r58537 FPC 3.1.1 i386-win32-win32/win64
> You can argue that I just need to include the path on Search Path but,
> please, don't. I want to use something like "dynamic paths".

Can you add 'msg' to the Project / Compiler Options / Other Sources?

> Continuing the test, if I use that unit as `msg in 'msg/msg.pas' on
> the other units, I got no error from CodeTools:
> ===begin===
> unit Unit1;
> // a unit that has a Form, for example
> uses
>   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
>   msg in 'msg/msg.pas';
> ===end===
> Which tells us that CodeTools knows how to read the "in 'path/unit'",
> but only if it was declared on the same unit that is using it.


> So, I can use the path on all units but as the compiler knows how to
> compile if I just put one declaration on the lpr, using the same
> indentifier `msg` in all program, I believe the IDE should know how
> to read this too.
> Am I right?

But this is not implemented yet.


More information about the Lazarus mailing list