3
votes

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.

1
Library path: Specifies search paths where the compiler can find the required files for the package, such as .dcp and .bpi files.LU RD
@LU RD: What do you mean? Do you mean that what I do should work, or that it shouldn't work. The path to my unit is in the library path, but it's only the .pas file. Do I need to set some parameter to where the .dcu file should be put and add that path to my library path?Svein Bringsli
Source files (.pas,.dfm,*.inc etc) should go into project search path, unless you provide that in the project file as in your example.LU RD
Before Berlin, I used XE 7. I have a collection of units that I keep in a dedicated folder, and I used these in many of my projects. This worked fine without having to add these units to each project file. Are you saying that this approach no longer works? I thought that was the whole idea of the library path in Delphi...Svein Bringsli
@SveinBringsli, a system path that is too long is an often source of errors. Every version of Delphi adds a lot of things in there, and suddenly you get strange errors. Instead of adding this information in the question, please put it in an answer.LU RD

1 Answers

4
votes

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.