How to fix the “teEngine not found” compile error

Today I had a very strange compiler error in Delphi 10.2, that occurred on one computer but did not occur on another computer:

myUnit.pas(28): error F2613: Unit 'TeEngine' not found.

The project was checked out from svn on both computers, so the source code was identical. So the unit “VCLTee.TeEngine” from TeeChart was in a subdirectory of the project sources and the project’s “Search Path” on both computers. But on one computer the compilation worked fine, on the other I got the error above.

The first thing I checked was that the TeeChart sources were not listed in the “Library Path”. I restrict my “Library Path” to the RTL and VCL units that come with Delphi and remove anything 3rd party libraries tend to add. Third party sources go into svn, are project specific and checked out via svn:external.

Further investigation showed that the prefix “VCLTee” was not listed in the Unit Scope Names setting of the project, that’s why the compiler as only looking for “teEngine” and did not find “VCLTee.TeEngine”. But again: How could the same project compile on the other computer? It should have failed on both!

Half an hour later I found the problem: There is also a “Unit Scope Names” setting in “Tools” -> “Options” -> “Environment Options” -> “Delphi Options” -> “Library”. On the computer where the compilation worked, “VCLTee” was listed there, but only under “32 Bit Windows”.

I missed that because the dialog defaults to the “64 Bit Windows” settings.

After I removed this entry, the compilation failed consistently on both computers. (Yes, I call consistent failures progress.)

And after I had added this entry to the project options and synced the sources, compilation finally worked on both computers.

You might ask why it was necessary to have “VCLTee” under “Unit Scope Names” at all, since the uses list should contain “VCLTee.TeEngine” rather than just “TeEngine”. The reason for this is simple: The unit in question is also used in Delphi 2007 projects where unit scoping was possible but no yet used widely. I had the choice whether I wanted the unit compile in Delphi 2007 projects or Delphi 10.2. Alternatively I could have added ifdefs around the uses clause, but since the IDE keeps on messing with these entries I don’t do that.

If you want to comment on this blog post, you can do so in the corresponding topic in the international Delphi Praxis forum.