The Wiert Corner – irregular stream of stuff

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

  • My work

  • 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,808 other followers

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?


Most people bump into the readonly .RES issue.

There are various opinions on having your .RES in version control or not. I think ultimately you shouldn’t, but it takes quite some effort to store ALL options in text files and generate the complete .RES file on the fly. For more on that, see for instance:

This takes a while to implement in projects, so for those having occasional read-only .RES issues, here is a trick:

Failing prebuild-event to make your .RES file writeable

I’ve tried to include this pre-build event in some projects that suffered from readonly .RES files most:

if exist $(PROJECTDIR)\$(PROJECTNAME).res attrib -r $(PROJECTDIR)\$(PROJECTNAME).res

But it doesn’t work: the BRCC command is executed before the pre-build starts:

Build started 11/27/2013 3:19:34 PM.
__________________________________________________
Project "C:\develop\md5sum\md5sum.dproj" (Make target(s)):
Target BuildVersionResource:
...\bin\cgrc.exe -c65001 md5sum.vrc -fomd5sum.res
CodeGear Resource Compiler/Binder
Version 1.2.2 Copyright (c) 2008-2012 Embarcadero Technologies Inc.
...
Deleting file "md5sum.vrc".
Target PreBuildEvent:
if exist C:\develop\md5sum\md5sum.res attrib -r C:\develop\md5sum\md5sum.res && echo ensured read-only C:\develop\md5sum\md5sum.res
ensured read-only C:\develop\md5sum\md5sum.res
...
0 Error(s)
Time Elapsed 00:00:01.37

So you must make sure the .RES files are read-write before you start compiling:

Working solutions to make your .RES file writeable

The most simple solution is to just make all .RES files read-write:

attrib -R /s *.res
attrib /s *.res

Or you could write/use an IDE expert that allows you to make certain files read-write again, like Making Source writable from the Delphi IDE – Stack Overflow.

Quotes from the interesting thread via Why does a projects res file need to …:

The version control issue:

I have recently migrated from Delphi 7 to Delphi XE 2 and use a version control system to store my work.
I book in the following project files:

  • cfg
  • dof
  • dpr
  • dproj (new for Delphi XE 2)
  • res

In previous versions of Delphi this was fine, I could leave these files read only, compile and build the project without issue. When I compile my project now I get the error:

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

This is resolved when I make the project res file writable, but this is a little bit annoying, especially when the file does not change.

The reply by Mark Edington:

This was a design change made to support multi-platform projects.

The fact that the file has to be re-written even when it hasn’t changed is something that I would consider a bug. I’d recommend you log a QC report outlining your issue.

There is an undocumented property you can add to your .dproj file which will prevent the build process from ever generating the .res file. If you add the following below the first section of your .dproj file it will turn off the .res file generation:

Be aware that this will effectively disable your ability to edit the project file settings stored in the project .res file from the IDE.

Hopefully you enjoy these bits of info as much as I did when researching them.

–jeroen

via:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: