title: C++ determine if compiling with debug symbols without defining a preprocessor symbol
body: <p>I have been using something like this: </p>
  
  <pre><code>int main(int argc, char *argv[])
  {
  
  #ifdef DEBUG
      printf("RUNNING DEBUG BUILD");
  #else
      printf("Running... this is a release build.");
  #endif
  ...
  </code></pre>
  
  <p>However this requires me to compile with -DDEBUG for the debug build. Does GCC give me some way for me to determine when I am compiling with debug symbols (-g flag) such as defining its own preprocessor macro that I can check for? </p>