Preprocessor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    Preprocessor

    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


  • Mattias Sjögren

    #2
    Re: Preprocessor

    [color=blue]
    >I would like to have one DEBUG definition to use for the whole project.
    >What is the best way to do this?[/color]

    Csc.exe /d:DEBUG

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



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • nalin perera

      #3
      Re: Preprocessor

      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.

      "Steve" <steve@I_dont_n eed_no_stickin_ penis_pills.com > wrote in message news:<e5fjZYMAE HA.684@tk2msftn gp13.phx.gbl>.. .[color=blue]
      > 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[/color]

      Comment

      • Steve

        #4
        Re: Preprocessor - Thanks

        You guys are the best. Exactly what I needed. Thanks.

        Steve




        "Steve" <steve@I_dont_n eed_no_stickin_ penis_pills.com > wrote in message
        news:e5fjZYMAEH A.684@tk2msftng p13.phx.gbl...[color=blue]
        > 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[/color]
        if[color=blue]
        > 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
        >
        >[/color]


        Comment

        Working...