Checking active solution configuration at compile time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!
Is it possible to check the active solution configuration (debug, release or some user defined) at compile time using for example preprocessor directives?

Best regards,
Michael
 
Michael said:
Is it possible to check the active solution configuration
(debug, release or some user defined) at compile time
using for example preprocessor directives?

While it is not exactly what you asked, do you know that an easy thing to do
is to check for the presence of debug options is to use something like

#ifdef DEBUG
// ...
#endif

You might want to look at the "Command Line" options under the C++ section
of your project's properties. The options that start with /D are the ones
which set preprocessor symbols.

I would guess that the automation/macro support in the compiler would allow
you to get the information you seek but to be honest that's just a guess as
I have never set out to look for it.

Regards,
Will
 
Well, I've already thought of this solution. I've seen something like

IF CONFIG = "Debug"

END IF

posted in other newsgroups but it seems like it only works with VB. I guess I'll have to use the proposed solution.

Regards,
Michael
 
It's as good a solution as any. Stick a Preprocessor Define (in the Project
configs) for each of your configs. I think DEBUG is automaticaly defined for
Debug builds, and it's easy to add some more for other configurations.

Steve

Michael said:
Well, I've already thought of this solution. I've seen something like

IF CONFIG = "Debug"

END IF

posted in other newsgroups but it seems like it only works with VB. I
guess I'll have to use the proposed solution.
 
Back
Top