Re: Headers common to .cpp and .rc files
- From: "David Webber" <dave@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 23 Apr 2008 18:09:24 +0100
"Tom Serface" <tom.nospam@xxxxxxxxxxxxx> wrote in message news:B32B0FD9-1BA3-4A48-A357-DB41A283D700@xxxxxxxxxxxxxxxx
I see Alex already answered you question, but if you manually modify the .RC file you may have problems if you use the RC editor to add or remove resources in the future since it takes liberties in rewriting the file. I typically do "extra" things in the .RC2 file that is created since there is no way of controlling how the editor rewrites the .RC file. It does include the .RC2 file automatically so that is a handy place to do your own things. You may already know this, but I figured I'd throw it out anyway...
Thanks Tom,
I'm an old hand at massaging rc files and rc2 files - and at cursing the resource editor - and usually get what I deserve :-)
For example:
One thing I spent a lot of time with was having #defines for the numbers in the VERSION INFO (in th rc2 file!) so that I can change the version number in a header file, and all my DLLs build with a common version number. The problem IIRC was getting the integer and string versions to match with only one #define for each component of the version number. It's a bit of an art, as it appeared to me at the time that the resource compiler does not respect ALL preprocessor definitions which the CPP compiler does.
In the end, my versioninfo definitions have almost nothng but #define'd entries.
The appended header definitions seem to work, but I never worked out why both _STR and STR are needed. I didn't work without them!
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm
// For version 10.0.0.31:
// Stringisation.
// For some reason the two-step definitions below work when it doesn't with a single
// step.
#define _STR(x) #x
#define STR(x) _STR(x)
// The following are used as defined quantities in the versioninfo resource:
#define VERMAJ 10
#define VERMIN 0
#define VERFIX 0
#define BUILDNUMBER 31 // See also VERSIONINFO.
#define VERMAJSTR STR( VERMAJ )
#define VERMINSTR STR( VERMIN )
#define VERFIXSTR STR( VERFIX )
#define BUILDSTR STR( BUILDNUMBER ) // Used to build stings below.
#define VERSIONSTRING VERMAJSTR "." VERMINSTR "." VERFIXSTR "." BUILDSTR
#define PRODUCTSTRING VERMAJSTR "." VERMINSTR "." VERFIXSTR "." BUILDSTR
===
.
- Follow-Ups:
- Re: Headers common to .cpp and .rc files
- From: Alex Blekhman
- Re: Headers common to .cpp and .rc files
- References:
- Headers common to .cpp and .rc files
- From: David Webber
- Re: Headers common to .cpp and .rc files
- From: Tom Serface
- Headers common to .cpp and .rc files
- Prev by Date: Re: Headers common to .cpp and .rc files
- Next by Date: Re: Loading numbered files in sequence
- Previous by thread: Re: Headers common to .cpp and .rc files
- Next by thread: Re: Headers common to .cpp and .rc files
- Index(es):
Relevant Pages
|