Re: #if in .rc file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The last I looked, the "preprocessor" for .rc files did not exist. There was a subset of
the C preprocessor functionality implemented as part of the resource compiler, but not as
a preprocessor, (for examples, macros in the .rc file cannot have parameters; it probably
doesn't implement the full #if logic, only #ifdef and #ifndef, etc.)

So I would not at all be surprised that #if defined() is not implemented. Why not use
#ifdef? And if you need more complex expressions, you may be out of luck.
joe


On Tue, 27 Jun 2006 10:54:17 -0500, "Eric Margheim" <NOSPAM***eric@xxxxxxxxxxxxx***NOSPAM>
wrote:

Can preprocessor directives be used in .rc files?

It's appearing to me they cannot. I am trying to do a conditional include
of resources in my app.rc file and it looks like it's including both parts
of the conditional.

#if defined (_DEFX)
#include "blah, blah"
#else
#include "yada, yada"
#endif

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Preprocessor symbols ignored in .RC file
    ... I created a configuration that has the string _W98 in the ... Configuration Properties C/C++ Preprocessor tab. ... But when I view the .exe file's version info using explorer, ... I also tried using a duplicate VS_VERSION_INFO resource in the .rc ...
    (microsoft.public.vc.mfc)
  • RE: resource preprocessor useage in 2003/2005
    ... not rc and changes to the resource ... preprocessor symbols are not propagated to .rc file definition. ... > If I add the USEBIN into the Preprocesssor Definitions of the MyProject ...
    (microsoft.public.vsnet.general)
  • Re: Using Preprocessor defines in menu resources
    ... preprocessor as the condition for one of the menus. ... (This is true for any resource) ... Please correct me so I may improve my English! ...
    (microsoft.public.vc.mfc)
  • Re: Manifest, VC 6 vs 2003 vs 2005?
    ... manifest resource -- could the IDE be providing one in addition to your manual entry? ... So I assumed the preprocessor was working. ...
    (microsoft.public.vc.mfc)
  • Re: Preprocessor directive
    ... >> preprocessor directives don't have scope. ... >> the beginning of the program to the end and make replacements as necessary. ... /* every occurence of BLAH from this point is replaced with 10 */ ...
    (comp.lang.c)