pre-compiler directive not functioning as expected

I am migrating to Arduino 1.0 and am having issues with maintaining backward compatibility.
The following code does not compile on Arduino 1.0 unless the "#include NewSoftSerial.h" is commented out, even though this part of the code should have already been skipped by the pre-compiler.

Any workaround that that will allow me to compile in both Arduino 1.0 and older versions without modifying the source will be most welcome!

Thanks!

// Arduino 1.0 compatibility
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#define WIRE_READ Wire.read();
#include "SoftwareSerial.h"
#else
#include "WProgram.h"
#define WIRE_READ Wire.receive()
#include "NewSoftSerial.h"
#endif

Here is the compiler message that goes away when the NewSoftSerial line is commented out with //

/home/justin/Documents/Arduino/clockthree/libraries/NewSoftSerial/NewSoftSerial.cpp:39:24: fatal error: WConstants.h: No such file or directory
compilation terminated.

It worked for me on V1.0. Didn't work on 0023 because I haven't got NewSoftSerial installed.

Pete

Where is the file those includes are in? Is it a .h file?

Mark,

The code snippet is from the Arduino .pde file.

Justin

You shouldn't need to include arduino.h or WProgram.h at all in a .pde file, the right one is provided for you

MarkT,

Indeed you are correct. I should have simplified my example to the bare essentials. I see now that the Arduino envirnment is ignoring the pre-compiler directives and thus tries to find "NewSoftSerial.h". I was wondering what the standard work-around is to maintain backward compatibility.

Justin

// Arduino 1.0 compatibility
#if defined(ARDUINO) && ARDUINO >= 100
#include "SoftwareSerial.h"
#else
#include "NewSoftSerial.h"
#endif