The functionality I expected was to be able to define some things in the primary source file only (the .pde file) , but not in any other sketch source file (other cpp files in the sketch directory).
The reason for having the defines in an include file is that they need to be known to some non-arduino programs that are compiled adn run in a different environment.
I can create a separate file to solve this but having a single .h file that can be included by the PC program as well is a little more convenient. But the main reason for posting is that this behavour was unexpected and I wonder if it is documented.
Perhaps an example will be clearer, here are three files that when placed in a sketch directory will exhibit the behavour :
The sketch pde file
#define ONLY_DECLARE_ONCE // defining this should declare a variable Foo in Myfile.h
int ledPin = 13; // LED connected to digital pin 13
void setup() // run once, when the sketch starts
pinMode(ledPin, OUTPUT); // sets the digital pin as output
void loop() // run over and over again
digitalWrite(ledPin, HIGH); // sets the LED on
delay(Foo); // Foo should be declared in the MyFile.h !!!!!!!!!!!!!!!!!!!!
digitalWrite(ledPin, LOW); // sets the LED off
A cpp file in the same directory
// a cpp source file
// source code for this file doesn't matter
And MyFile.h that is included by both of the above :
int Foo = 1; // declare Foo in a file that has ONLY_DECLARE_ONCE defined
#endif // MyFile_h
Compiling this sketch will generate the message: error: 'Foo' was not declared in this scope