Archived

This topic is now archived and is closed to further replies.

Conditional resources

This topic is 6575 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
I am having the same problem. Is it even possible to use #ifndef's in rc2 and rc files? Because I never got it to work...

Share this post


Link to post
Share on other sites
Well, the thing you have to realize about .rc files is that they aren't C/C++, they're a special scripting language. There are C/C++ #defines and stuff in them, but if you look closely, they aren't actually part of the file, they are script settings for the resource.h file generation and things like that.
You might try putting the stuff you want to flag out in the rc2 and attempting to only define that when in Release, or you might try messing with the resource.h file and seeing if you can remove them there. I haven't tried either so I can't guarantee success. You could also ask on the www.codeguru.com forums, as there might be someone there who has tried it...

-fel

Share this post


Link to post
Share on other sites
I think you gave me an idea. I think I'll try to put something like this in the resource.h file:
#ifdef _DEBUG
#define PICTURE BITMAP DISCARDABLE IDB_IMAGE
#else
#define PICTURE //
or something like that.
Maybe that will work...

Share this post


Link to post
Share on other sites
I am making a Pacman clone, and I want to make it so that in the final release, all the pictures and stuff are included as resources, instead of as separate files. The loading of the pictures is no problem, because I can load them from resource, but the problem is I can't seem to make it so that it only includes the picture resource in a release build. I tried adding an #ifdef _DEBUG..#endif pair surrounding the bitmap declaration in the main rc file, but VC++ changed it. Then somebody suggested I use an rc2 file, so I tried that too, but the bitmap is never included in the file!! Can I make it so that it only compiles the picture as a resource if _DEBUG is defined? If so, how?
Any help is appreciated,
Jonathan Little

------------------
http://qoy.tripod.com

Share this post


Link to post
Share on other sites