#include search order

Sorry for stupid question.
If there's #include <file.h> in the code, where the compiler will search for it?
Is there any usable way to keep includable files somewhere outside of Arduino-022/libraries/ folder?

UPD: Is there a way to set the compiler to ignore/overwrite duplicate functions?

If there's #include <file.h> in the code, where the compiler will search for it?

In one of three places - your libraries folder in your sketchbook, the libraries folder for Arduino, and the avr path.

If you #include "file.h" in the code, the library will be looked for only in the sketch folder.

Is there any usable way to keep includable files somewhere outside of Arduino-022/libraries/ folder?

You can include files using the complete path. Generally not recommended as the code is then not shareable.

Thanks! Than what will be the correct direct path, if, for example, file.h located in sketches/project1/lib/?
And for 'AVR path' - do you mean, there's a file system inside AVR chip?

Than what will be the correct direct path, if, for example, file.h located in sketches/project1/lib/?

Beats me. Where does sketches live? Why do you not want to use the sketchbook libraries folder?

do you mean, there's a file system inside AVR chip?

No. There are standard header files that the avr tool chain knows how to find, like math.h, stdlib.h, etc. In general, you should not need to care where these files really live.

Why do you not want to use the sketchbook libraries folder?

Because arduino compiler reports an error when it finds two or more files with the same functions (e.g. versions of the same library.h).
I'm a web programmer and this logic makes me stupid: in web, the last function definition overwrites all previous ones, and therefore, we never have problems with incorrect paths.

My second question (about the direct path) was of the same type:
For example, file.h is here: flash_drive://Arduino/sketches/project1/lib/file.h
flash_drive might became D:/ on laptop and F:/ on desktop, etc. So I think, there must be an absolute path, beginning from sketches folder, right?

I believe Arduino copies your entire sketch to a temporary folder first, then runs the compiler, this behaviour makes any sort of complicated pathing troublesome

Try to design your code with only relative paths and also without using "..", if you must use absolute paths, then try not using removable storage.

Having compiler options would solve all of these problems with -I, but nooooo...

Because arduino compiler reports an error when it finds two or more files with the same functions (e.g. versions of the same library.h).

The reason for having the same class in two different libraries escapes me. The whole reason for creating a class/library is so that you only write the code once.

I've finally got the point in this article.
My problem was thad I didn't know that Arduino doesn't have "root directory" and it even has no transparent inclusion mechanism.
Instead, it simplifies sketch inclusions but adds penalty to standard mechanisms. Use relative paths, Luke.
Thanks all!