I am a veteran C/C++ programmer but new to the Arduino IDE. I downloaded and saved a project (I think it is called a "Sketch" in Arduino lingo). After opening the ".ino" file, the source only shows one line of code:
#include <grbl.h>
Yet when I build it, the IDE seems to find all of the files. Where is this information stored? It is not in the ino file because all it has is some comments and that one include statement. The header certainly doesn't indicate where all of the "*.c" source files are so how does it know where they are?
Very puzzling. I don't like these mysterious automatic things.
Built into the source code, and the per-board-type configure files.
Plus: very easy. Minus: not easily user-changeable - put your files and libraries where they are supposed to be, or else!
You're welcome to specify the full path to library files if you like. However, if you use this to allow you to store libraries in non-standard locations then you can run into problems because the libraries may incorrectly use the Arduino IDE's include file scanning system for including internal dependencies or may correctly use it for external dependencies.
It's not quite so easy with including sketch files since they are saved to a temporary build folder before compilation. I can't imagine why you would want to specify the full path to sketch files anyway.
Another benefit of the Arduino IDE's "mysterious automatic" system is portability. If you have a bunch of hard coded paths in sketches and libraries then it will be a nightmare for anyone else who doesn't have the exact same folder structure. Someone did something like that (a relative path to an external dependency) years ago in a commonly used display library and it has caused so many headaches for beginners.