Nothing defined in your .ino will be visible when your .cpp file is compiled.
I'm not sure why you are expecting this behavior given it looks like you are compiling the .cpp file as an Arduino "library" which is compiled separately/independently.
Turn on full output from the IDE so you can Look at the build output.
You should see that that the .ino is converted to a .cpp and compiled separately from your .cpp file.
When compilations are separate no symbols/macros created from/inside one compilation module will be visible by another.
Now if you have .cpp files in the same directory as the .ino, then things are different
as I believe that the IDE will smash them all together and not compile them separeately.
The best thing to do is watch the output from the IDE to see how things are built that will show what is happening.
The only way to have macros in a .ino to alter the building of an Arduino "library" is to put the library code into the .h file.
i.e. define the class inside the .h file vs putting it inside a .cpp file.
While many people balk at this, it is allowed and even required if you do templated classes.
Note I say "library" because Arduino "libraries" are a bit funky in that they are not handled the typical/normal way real libraries are handled in a gcc / embedded environment.
They are just compiled into objects and linked in vs put into a library (.a) file that is linked against.
The only true/real library in the Arduino platform is the core library.
The .ino file defines MAKE_ERR and then includes someHeader.h. Since MAKE_ERR was defined when the header was included, it defines MAKE_ERR1.
For the .ino file.
The .cpp file includes someHeader.hwithout defining MAKE_ERR. So MAKE_ERR1 is not defined.
For the .cpp file.
So your line #error in cpp in the .cpp file is skipped because MAKE_ERR1 is not defined for the .cpp file.
Your .ino file and .cpp file are not conglomerated into one source file and compiled together. They are each compiled separately and each create their own separate object file.
No, there are no different forms of someHeader.h, it is a single file. But it included to two different compile sources, that is a cause of different results.
If you turn on a flashlight at night, it brightly illuminates everything around you. And on a sunny day you will hardly notice its light. But this does not mean that the flashlight is different at night and during the day.
No, if it is a file with .cpp extension it will be compiled separately - even if it is located in the sketch directory. Only if has an .ino extension it will be concatenated to the main .ino file before compiling. ( If you create a tab without any extension in the IDE, it will get an .ino extension automatically ).
You are correct. I was misremembering.
but it actually creates a main .cpp file for compiling.
i.e. if sketch is named foo, with a foo.ino file the concatenated file is foo.ino.cpp and that is what gets compiled.
It also concatenates in the .pde extensions as well for compatibility with older code.
And it does not generate function prototypes for the functions in the .cpp file that are in the sketch directory.
And as an added bonus (at least on linux) the IDE leaves lots of turds on the filesystem down in /tmp after doing its builds - and they remain there even after exiting the IDE.
You can go down into these turds to see the remanants of what the build did.
i.e. you can find and all the files created by the IDE that were used for its build.
You can see them and their locations if you look at the build output.
By coincidence I'm also trying to resolve #error usage in one of my sketches, but AFAIK it seems #error is not even valid as pre-compile instruction with the IDE.
I'm hoping there a usage description for all IDE pre-compile commands somewhere, yes?
But this is what happens if I compile your example in post#1:
In file included from C:\Users\cj\Documents\ARDUINO\SKETCHES\AAA\AAA.ino:2:0:
...\Users\ ...\Documents\ARDUINO\SKETCHES\AAA\someHeader.h:6:2: error: #error in header
#error in header
^~~~~
exit status 1
Compilation error: #error in header
... Users\...\Documents\ARDUINO\SKETCHES\OLED\OLED_master_c\OLED.cpp:21:21: error: my bad
#pragma GCC error "my bad"
^~~~~~~~
exit status 1
Compilation error: my bad