title: Defining variables within #if #else #endif in Arduino IDE
body: <p>I was hoping that someone could shed light on why this code does not compile in Arduino IDE (using 1.0.5). The following code only compiles if DEBUG=1 but not if it is set to 0. </p>
  
  <p>What I was hoping to achieve was just a simple way to use the same code when i swap LED drivers and just flip the DEBUG bit prior to recompiling and uploading.</p>
  
  <p>Note: this sample is the whole code to be compiled in the IDE (no other code is required).</p>
  
  <p>problem code:</p>
  
  <pre><code>#define DEBUG 0 //DEBUG=1 works, DEBUG=0 causes compiler error
  
  #if DEBUG == 1
    int x = 123;
    //Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
  #else
    int x = 567;
    //Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();
  #endif
  
  void setup() {  }
  
  void loop() {  }
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>core.a(main.cpp.o): In function `main':
  C:\arduino\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to `setup'
  C:\arduino\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop'
  </code></pre>