Conditional Compilation Symbols Are Defined or Undefined

At any given point in your source code, while the compiler is compiling that section of code, a particular conditional compilation symbol is either defined or undefined.
You define a conditional compilation symbol
  • Using the #define preprocessor directive
  • Using the /define option on the compiler command line
  • Implicitly (for DEBUG and TRACE symbols), when selecting a build option for a project
You undefine a conditional compilation symbol
  • Using the #undef preprocessor directive
  • When reaching the end of a source file
A conditional compilation symbol is either defined or undefined–it has no value.
You check whether a conditional compilation symbol is defined by using the #if or #elif preprocessor directives.


A conditional compilation symbol remains defined in a source file until the end of the containing source file or until encountering an #undef directive (whichever comes first).