Search code examples
delphidelphi-2010delphi-10-seattle

Delphi compatibility issue


There seems to be a compatibility issue between Delphi 10 Seattle and Delphi 2010

I've written a school project using Delphi 10 Seattle but my teacher still uses Delphi 2010. When I transferred and opened the source code in Delphi 2010 it gave errors.

I've installed 2010 on my PC to replicate the error (screenshot below)

Screenshot

"File not found Vcl.Forms.dcu"

Any thoughts how to get this to work, the marking/moderating takes place with Delphi 2010.


Solution

  • Unit scope names were added in Delphi XE2. Vcl.Forms does not exist in older versions of Delphi. Instead, it should just be Forms.

    The reason is because of the introduction of the Firemonkey framework in Delphi XE2. With Firemonkey also came the necessity to differentiate Vcl.Forms from Fmx.Forms. The same applies with many other units, such as Graphics. Delphi 2010 did not have Firemonkey, so it did not yet enforce this prefix.

    If you need code to compile in Delphi 2010 and Delphi 10 Seattle, specify only the base unit names in your uses clause (Forms, Graphics, etc), and make sure your Delphi 10 Seattle project has the necessary scope(s) (Vcl, Winapi etc) setup in Project > Options > Delphi Compiler > Unit scope names. By default, new projects should already have this. If not, you can add Vcl and any other prefixes you need. This will make sure the compiler can find Vcl.Forms even when you specify only Forms in code.