So far, I've read that no one can identify, other than moving the included files to the directories that the source file is in...
A
C:\Arduino\MyProgram contains 'MyProgram.ino.... as a result, if 'MyProgram.ino' needs / relies on 'myheader.h', myheader.h can only be in either of two places.... A: C:\Arduino\MyProgram
OR
B: the common libraries directory.
standard/ansi C / C++ behaviour allows one to specify the path as a subpath of the .ino file. To explain this, using the above, I could put myheader.h in C:\Arduino\AllMyHeaders and the #include would be as follows #include "../AllMyHeaders/myheader.h"
This specifies (the two dots), go back to the root of the current directory (root of where MyProgram.ino is) = C:\Arduino, and then add "AllMyHeaders/" to the path to find the directory for "myheader.h"
In standard / ansi C / C++, this, since it is specified by the developer, is the first location the compiler will look.
I have tried similar with the IDE, and still can't specify the path. Does the compiler actually follow ANSI C standards, OR, if not, where are the actual specs / changes?
//From a s/w developer with over 30+ years experience!!!!
The IDE will also look in the sketch folder for includes if you put the name in quotes instead of <>'s - I don't think you can do .. to access the parent folder though, not sure.
The compiler is standard ansii C, but the IDE does some pre-processing and moves files around (into a "build" directory), so ".." is almost certainly not where you think it is.
C:\Arduino\MyProgram
That's "rhetorical", right? Sketches are normally someplace like C:\Users\username\Documents\Arduino\MyProgram
(and as mentioned above, copied to some mysteriously named temp folder before the actual compile.)
The Arduino IDE uses gcc underneath so all the 'standard' include rules and paths work the same as normal gcc since it is using normal gcc.
You are being burned by the way IDE works and how it does its builds not the compiler.
What throws a wrench into things is that the IDE does not compile sketches in place.
The IDE does some preprocessing of its own on the .ino file to generate a .cpp file
That cpp file is along with all the other files and subdirectories in your sketch directory is copied down to the tmp working area.
What they don't do is then add the original directory location to the include path.
As a result if you attempt to include any header file that is above the directory where the .ino file originally lived, by specifying a relative path, it will fail since the .cpp file is being compiled in a different location than the original .ino file so any relative path from the orignal .ino file doesn't exist from the location where the .cpp file is being compiled.
You can see the problem if you turn on verbose mode and carefully look at the command for the compile.
You will see the compile for the .cpp file is happening from a temporary working directory and the relative path specified for the header file will obviously not exist.
If you create a subdirectory under the directory for the project where the .ino files lives, that will work.
i.e.
if you put your headers in MyProgram/AllMyHeaders
Then #include "AllMyHeaders/myHeader.h"
would work.