Using directives in Resource File

Posted on 2008-11-13
Last Modified: 2013-12-14
I am using the directive   "#if defined(MACHINING_CTR)" in the resource (.RC) file.  If I put a "#define MACHINING_CTR" command in the .RC file then the #if directive works correctly.  However if instead of using the "#define" statement, I define the MACHINING_CTR as a Preprocessor Definition then the "#if" directive does not work.  Does the resource file not recognize Preprocessor Definitions?
Question by:jimrichmond
    LVL 39

    Accepted Solution

    >>>> Does the resource file not recognize Preprocessor Definitions?
    No, the resource file was compiled by the resource compiler (rc) and not by C++ compiler which firstly invokes the C/C++ precompiler.

    You can add directives for the rc when opening the resource file and go to 'Edit - Resource Includes ...'. Here you have two multi-line edit boxes where you could add #include or #define statements. Or you use global environment variables which should work as well.

    Author Closing Comment

    Thank you for the help

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now