Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 144493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:15:43+00:00 2026-05-11T08:15:43+00:00

depending on a compile switch (values are COMPILE_A or COMPILE_B ), which is set

  • 0

depending on a compile switch (values are COMPILE_A or COMPILE_B), which is set in the form of an envorinment variable, I want to compile my application with different settings, like application name and splash screen.

I got this far:

  1. In ‘Project / Settings / C/C++ / Preprocessor Definitions’ I added $(COMPILESWITCH) (results in command line option /D '$(COMPILESWITCH)').

  2. In stdafx.h I can use the following code, which means I correctly defined the preprocessor definition via the command line parameter:

     #if defined COMPILE_A     #   define IDB_SPLASH IDB_SPLASH_A     # elif defined COMPILE_B     #   define IDB_SPLASH IDB_SPLASH_B     # else     #   error Unknown or undefined target compile switch; cannot compile!     # endif 

But I’ve noticed the ‘Condition’ property under ‘ResourceView / [right-click] / Properties’… The help text says this:

Condition

Determines the inclusion of the resource. For example, if the condition is _DEBUG, this resource would be included only in debug builds.

This looks like the elegant way of doing it, right?

Specifiying _DEBUG as condition works. So as _DEBUG is specified via /D _DEBUG my $(COMPILESWITCH) should also work, right?
For some reason it doesn’t; why?

Or is there even another, better way to achieve what I want?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:15:44+00:00Added an answer on May 11, 2026 at 8:15 am

    I guess I just solved my problem…

    The resource compiler uses its own preprocessor.
    Therefore the same preprocessor definition has to be added under "Project / Settings / Resources / Preprocessor Definitions".

    Edit: String Resources

    The above doesn’t work for string resources as they don’t have a "condition" property…

    I chose to use the res\<projectname>.rc2 custom resource file which won’t be touched by the resource editor. The content looks like this

     #if defined(COMPILE_A)     STRINGTABLE DISCARDABLE      BEGIN         IDR_MAINFRAME           'AppTitle A'     END #else #   if defined(COMPILE_B)     STRINGTABLE DISCARDABLE      BEGIN         IDR_MAINFRAME           'AppTitle B'     END #   else #       error Compile switch not defined or unknown; cannot compile! #   endif #endif 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 176k
  • Answers 176k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm not sure about the "slide" event - but most… May 12, 2026 at 3:16 pm
  • Editorial Team
    Editorial Team added an answer To answer the title question. Yes it is redundant, but… May 12, 2026 at 3:16 pm
  • Editorial Team
    Editorial Team added an answer Your pmdoc is a distribution project, and you've set the… May 12, 2026 at 3:16 pm

Related Questions

Platform: C# 2.0 WinForms I have a factory class that provides an instantiation of
I'm trying to upgrade an app ( Clarke ) to provide 10.6 compatibility. My
Where I work we need to rethink the way we develop software and keep
I know that I can check the current state of Delphi's switch directives using

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.