Resource compiling delphi project

Hi all

Delphi 10.4.2/FB 8

I have just discovered that my FB script is not compiling a resource file in my delphi project.

All is good in the IDE but it does not compile when I build in FB

I have this line in the DPR file

{$R ‘CMfastreports.res’ ‘CMfastreports.rc’}

and the res file is in the same folder as the project file

I have ticked “compile project resources” and “regenerate resource” in the FB compiler object

Appreciate any ideas on what I am missing

Thanks
Tony

Hi Tony

The delphi command line compilers (which we call) do not know how to handle resources like that - only the IDE does.

So there are a couple of ways to work around that.

  1. Change the entry to {$R ‘CMfastreports.res’ } and then add an Embarcadero Resource Compiler action to your FinalBuilder project before the delphi action. This might cause you issues with development - I work around this by having a copy of the compiled resource file in version control (so I have a copy for dev) - but in my build process I always recompile them.

  2. Remove the line from the dpr and then add the resources that it would bring in via Delphi Project menu, Resources and Images. The IDE will add entries to the dproj that we can pick up and compile, and an entry in the dpr to reference the .dres file.

Thanks for the explanation Vincent.

I went for option 1 compiling my resource file separately.
I wanted to use a prebuild event to copy some resource files when compiling in the IDE but Delphi compiles the resources THEN runs the pre-build event… (I would consider resource compiling part of the build but never mind)

Cheers