Preprocessor

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have never really used the preprocessor commands so this may seem like a
newbie question.

In my development code, I short circuit certain variables being set by
hardcoding them. So for example I would say something like

PlanID = 1;

However, in the production code, PlanID comes already assigned to me and if
I keep this assignment, I will be using the wrong PlanID.

So if I use

#define DEBUG
:
:

#if DEBUG
PlanID = 1;
#endif

This works great.

HOWEVER......
I would like to have one DEBUG definition to use for the whole project.
What is the best way to do this?

Thanks.

Steve
 
I would like to have one DEBUG definition to use for the whole project.
What is the best way to do this?

Csc.exe /d:DEBUG

if you're using the command line compiler, or set it in the project
properties in VS.NET.



Mattias
 
Hi Steve,

Add the /define:DEBUG switch during compilation or add the DEBUG
symbol in the Conditional Compilation Constants in the property pages
for the project. (AFAIK the DEBUG symbol would already be defined by
default for debug builds)

Regards,
Nalin Perera.
 
Back
Top