Delphi can’t find units in the library path

delphi

I've just installed Delphi 10.1 Berlin, and I've run into a problem with the library path. When using units in the library path (at least some), Delphi can't find them , and gives an F2613-error, "Unit XXX not found".

To set up a very simple test, I created a unit called "SampleUnit.pas", with a single function (sum) in it, put the file in a newly created folder, "C:\TempLibrary", and added this folder to Options->Delphi Options->Library->Library path. I checked the spelling several times, and I am totally sure that everything is correct. I then made a console application like this

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  SampleUnit;

begin
  writeln(Sum(12,13));
end.

and compiled it. Boom, "[dcc32 Fatal Error] Project1.dpr(9): F2613 Unit 'SampleUnit' not found."

If I replace the offending line with

uses
  SampleUnit in 'c:\templibrary\sampleunit.pas';

it works just fine. Adding "C:\TempLibrary" to the projects search path will also solve the problem.

What am I missing? This has worked on previous versions of Delphi, and it does indeed work on other installations of the Berlin version as well (I have another installation on a virtual machine, where it works just fine)

I realize this might be a problem with my setup that may be hard/impossible for others to pinpoint, but if anyone can offer any insight as to where I should look that would be great.

UPDATE:

The problem has been solved, but I'm not sure excactly what solved it. I started a reinstall, and got a warning that said the length of my system path was close to the length limit. I cleaned the system path (removed references to old RAD studio installs among other things), then reinstalled Delphi 10.1 Berlin, and now everything works again.

Best Answer

It seems the problem was the length of my system path. I shortened it by removing references to earlier Delphi versions and some other obsolete stuff and reinstalled Delphi, and now everything works as before.

PS: After shortening my system path, I tried to build my test project before reinstalling Delphi, but that didn't work. Maybe something went wrong during the install, which may or may not have been caused by the length of the system path. I can't say with absolute certainty that it was the system path that caused the problem, but it seems the most likely candidate.

Related Topic