The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,991 other followers

Archive for the ‘Resource Files and Scripts (.res/.rc)’ Category

When BRCC32 throws `Fatal error Illegal macro definition in command line or defines page.` in a DUnitX project

Posted by jpluimers on 2017/04/19

I had a Fatal error Illegal macro definition in command line or defines page. thrown by BRCC32.exe in one of my Delphi projects.

As cgrc.exe could build the .rc file [source in Russian; WayBack], I reproduced it from the console with an Empty.rc file that has no content. That way I could rule out file content: now it had to be command-line arguments which is a different cause than any of the search results I found before.

My project was based on one of the DUnitX test projects. It ran in Delphi XE8, but the Delphi version doesn’t matter as BRCC32 hasn’t been updated since 1999.

Further below are the failure/success examples; this went wrong:

  1. DUnitX uses the DUNITX-DEBUG define to enable debugging of DUnitX itself in DUnitX.inc which also supports the DUNITXDEBUG define in the same area.
  2. Delphi will translate a .RC file in a project into a BRCC32.exe call adding the project conditional defines and search paths
  3. BRCC32.exe doesn’t like hyphens in conditional defines throwing a non-descriptive error Fatal error Illegal macro definition in command line or defines page.

So either removing DUNITX-DEBUG or changing it into DUNITXDEBUG solves the problem. Hence my pull-request.

Read the rest of this entry »

Posted in Delphi, Development, Resource Files and Scripts (.res/.rc), Software Development, Windows Development | Leave a Comment »

Delphi, resource files and includes – some links

Posted by jpluimers on 2017/02/23

Some links that were useful getting back into using Delphi with resource scripts and include files:

Maybe I should have considered this alternative:

–jeroen

PS: a first go on a resource file structure for Version Information is below.

Read the rest of this entry »

Posted in Delphi, Development, QC, Resource Files and Scripts (.res/.rc), Software Development | Leave a Comment »

Delphi To Go: Include resource files in your Delphi build process

Posted by jpluimers on 2017/01/05

Something to remember: Delphi To Go: Include resource files in your Delphi build process

Note it’s not enough to add a line like this to your .dpr file:

{$R 'New1.res' 'New1.rc'}

The resources actually needs to be part of your .dproj file (which basically is an XML msbuild file adhering to the MSBuild Project File Schema Reference).

That way, the BrccCompile target in $(BDS)\bin\CodeGear.Delphi.Targets will automatically pick it up during build.

I just checked and these target files support BrccCompile:

  • ...\Embarcadero\RAD Studio\7.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\RAD Studio\8.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\RAD Studio\9.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\RAD Studio\10.0\bin\CodeGear.Delphi.Targets
  • ...\Embarcadero\RAD Studio\11.0\bin\CodeGear.Delphi.Targets
  • ...\Embarcadero\RAD Studio\12.0\bin\CodeGear.Delphi.Targets
  • ...\Embarcadero\Appmethod\13.0\bin\CodeGear.Delphi.Targets
  • ...\Embarcadero\Studio\14.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\Studio\15.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\Studio\16.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\Studio\17.0\bin\CodeGear.Delphi.Targets 
  • ...\Embarcadero\Studio\18.0\bin\CodeGear.Delphi.Targets

Which means it’s available as of Delphi 2007 until at least Delphi 10.1 Berlin and might even work in Delphi 2006

It could be a little bit flakey in Delphi 2007 (I’ve had many msbuild issues there) but more recent versions should be fine.

–jeroen

Related: I have a big file to add +’ at the beginning of a line and ‘ at the end…- shlomo abuisak – Google+

 

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Resource Files and Scripts (.res/.rc), Software Development | Leave a Comment »

Resource decompiler – converting/decompiling/extracting .RES files into .RC files and separate resources

Posted by jpluimers on 2016/07/07

via: Resource decompiler

One day I’m going to need ResourceHacker as it has an -extract option to extract resources.

The above link even has a batch file that can server as a start automating that process:

@echo off
set file="GeneSys"

if exist %file%.rc del %file%.rc

ResHacker.exe -extract %file%.res, %file%.rc,  Bitmap,,
ResHacker.exe -extract %file%.res, temp.rc,  Icon,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  Dialog,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  Menu,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  StringTable,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  Accelerators,,
type temp.rc >>%file%.rc
ResHacker.exe -extract %file%.res, temp.rc,  VersionInfo,,
type temp.rc >>%file%.rc
del temp.rc

I save it as extract.bat and a commandline usage: extract GeneSys will extract all the resources from GeneSys.res

–jeroen

PS: as the MASM forum sometimes nags with logins, I saved the above page in the wayback machine.

I’ve verified that [WayBack] ResourceHacker and the downloads ([WayBack] installer and [WayBack] portable) are there too.

Read the rest of this entry »

Posted in Development, Resource Files and Scripts (.res/.rc), Software Development, Windows Development | Leave a Comment »

Pre-build trick does not work to circumvent [BRCC32 Error] xxx.vrc(1): error creating xxx.res (via: Embarcadero Discussion Forums & StackOverflow)

Posted by jpluimers on 2014/01/10

Ever since around Delphi 2007, it started to use temporary .VRC files to re-build the project .RES file.

It confuses people, and with reason as the only public information about it on the dockwiki seems to be in the Version Info page (though there is more on the other embarcadero sites).

The reason is that parts of the .RES file are no more leading in the process of getting them from your project options to the final binary (EXE/DLL/BPL/…) of your project.

Delphi XE3 for instance can have these resource structures in the .VRC file:

Except for type 24, Delphi XE2 seems to have the same kinds of resource types.

All in all, most if not all of the .RES files are being auto-generated for at least a couple of years now so there is less and less need to put it under version control.

The problem is that if for one reason or the other, your project .RES file becomes readonly, and you get errors like mentioned in Why does a projects res file need to ….

[BRCC32 Error] xxx.vrc(1): error creating xxx.res

.RES in VCS or not?

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Event, QC, Resource Files and Scripts (.res/.rc), Software Development | Leave a Comment »

 
%d bloggers like this: