1

I was having some problems with this code executing:

#if TRACE
            dbgLog = new LogInfo( "PlatypusCE" );
#endif   

This was occurring even though "TRACE" was commented out above, right after a large block of general comments:

//#define TRACE

Once I added this below it:

#undef TRACE

...so that it is:

//#define TRACE
#undef TRACE

...it works as desired, though (the "#if TRACE" code doesn't execute).

Is it really necessary to undefine something that has not been defined (is commented out)? It seems bizarro.

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 2
    Any chance that `TRACE` was being defined through [compiler switches](http://msdn.microsoft.com/en-us/library/0feaad6z.aspx) and not `#define`? Did you look at the project settings? – Jon Aug 25 '14 at 22:14

2 Answers2

3

By default, in the profiles Debug and Release, Visual Studio will define the TRACE constant. You can change this behavior in the project settings (in the Build tab). The DEBUG constant is similar, active by default in the Debug profile (but not Release).

Mephy
  • 2,978
  • 3
  • 25
  • 31
2

TRACE is one of the two constants defined by default for debug builds:

TRACE

Lucas Trzesniewski
  • 50,214
  • 11
  • 107
  • 158