title: Does not compile with a preprocessor value on the command-line
body: <p>Where am I going wrong; I want to define a preprocessor value on the command-line for g++ but it fails. Below is sample code that replicate my problem:</p>
  
  <p>[edit] I'm using:<br />g++ (Debian 4.3.2-1.1) 4.3.2<br />GNU Make 3.81</p>
  
  <p>test.h</p>
  
  <pre><code>#ifndef _test_h_
  #define _test_h_
  
  #include "iostream"
  
  #if defined(MY_DEFINED_VALUE)
  #if (MY_DEFINED_VALUE != 5)
  #undef MY_DEFINED_VALUE
  #define MY_DEFINED_VALUE 3
  #endif //(MY_DEFINED_VALUE != 5)
  #else //defined(MY_DEFINED_VALUE)
  #error  Error - MY_DEFINED_VALUE is not defined
  #endif //defined(MY_DEFINED_VALUE)
  
  class test
  {
  public:
   int val;
   test() {}
   void show() { std::cout &lt;&lt; "val = " &lt;&lt; val &lt;&lt; "\n"; }
  };
  
  #endif //_test_h_
  </code></pre>
  
  <p>test.cpp</p>
  
  <pre><code> //#define MY_DEFINED_VALUE 5
   #include "test.h"
  
   int main()
   {
    test t;
    t.val = MY_DEFINED_VALUE;
    t.show();
    return 0;
   }
  </code></pre>
  
  <p>Makefile</p>
  
  <pre><code>#=====
  CC = g++
  LD = g++
  USERDEFINES = -DMY_DEFINED_VALUE
  CFLAGS = -Wall
  LDFLAGS = 
  RM = /bin/rm -f
  SRCS = test.cpp
  OBJS = test.o
  PROG = test
  #=====
  $(PROG): $(OBJS)
   $(LD) $(LDFLAGS) $(OBJS) -o $(PROG)
  #=====
  %.o: %.c
   $(CC) $(USERDEFINES) $(CFLAGS) -c $&lt;
  #=====
  clean:
   $(RM) $(PROG) $(OBJS)
  </code></pre>
  
  <p>If I uncomment the <code>#define</code> in test.cpp, all is well (prints 5). If I comment it I get the <code>#error</code>.</p>