Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recompile modifications to VCL source file (Menus.pas)?

We have a modified menus.pas.

At

uses ...,Controls,...;

The compiler raised a fatal error:

[DCC Fatal Error] Menus.pas(*): F2051 Unit Controls was compiled with a different version of Menus.TPopupMenu

tried:

deleted all dcu in the project.

build

build all

tried adding the file to library path which leads to add db folder(from vcl too) and then to

[DCC Error] jpeg.pas(872): E2065 Unsatisfied forward or external declaration: 'jpeg_save_markers'

which is a dead end.

deleted the controls.dcu (all 3) and the delphi did not know automaticaly to recompile them, instead reported that controls.dcu is missing.

like image 348
none Avatar asked May 06 '12 13:05

none


2 Answers

In Delphi XE7 (and below) themes and styles are totally unusable.

So, I patched the file ( Delphi XE7\source\vcl\Vcl.Themes.pas ) add it to the project file, compiled it and got a DCU. I replaced the old DCU ( Delphi XE7\lib\win32\release\Vcl.Themes.dcu - same for "debug" folder) with the new one. Everything works smooth now. I don't even have to link the PAS file to my projects.

like image 167
Server Overflow Avatar answered Oct 24 '22 18:10

Server Overflow


Here is how I handle modifications to VCL source files:

  • Make a copy of the file in your project structure. Either add the file to your project, or make sure the search path finds your modified file.
  • Make modifications, but only in the implementation section. You are not able to modify the interface section if you use any other units that themselves use the unit you are modifying.
  • Explicitly set the compiler options at the top of the modified source file. Use default Delphi options, as found by pressing CTRL+O O in a default vanilla project.

I'd guess that one of the final two bullet points is what is tripping you up.

like image 25
David Heffernan Avatar answered Oct 24 '22 18:10

David Heffernan