As the IDE copies everything under your sketch directory into a temp directory somewhere else before compiling, your relative path is no longer valid when compiling and the accessory files (.cpp) won't be seen and compiled / linked in.
just put your library in the known shared library directory or as you did before copy the files inside your sketch directory.
It will definitely work. You must understand that the --libraries flag is used to specify an additional path under which Arduino CLI should search for libraries. Note it is plural. This means the path must be to a folder under which libraries are installed, NOT the path to a library folder. In your example, that would be the path of the proj folder (under which the share library is installed).
If you instead want to add an additional single library, use the --library flag instead. This flag would allow you to pass the path of the share library folder in your example.
[quote="evily, post:3, topic:1389396"]
I tried to use symlinks. This way:
This is because the Arduino sketch build system only compiles the source files from the root of the sketch folder, and from folders under the src subfolder of the sketch folder:
If you had placed the symlink under a subfolder named src (and adjusted the #include directives in your sketch code accordingly), then the error would not have occurred.
Just install the library normally, under the libraries subfolder of the sketchbook folder (referred to as directories.user by Arduino CLI)
You can make the changes to the library in the normal location.
Great news! The distinction between the --libraries and --library flags is a bit subtle.
It is not possible to configure additional library locations (as you can do via Arduino CLI's --libraries and --library flags) when using Arduino IDE. However, you can indirectly configure the single location it searches for globally installed libraries (and where its Library Manager manager feature installs libraries. Arduino IDE uses the libraries subfolder of the sketchbook folder for this purpose. It is not possible to set an arbitrary location for use instead of that libraries folder, but it is possible to configure the location of the sketchbook folder, and thus also the location of the parent folder of the libraries folder. I'll provide instructions you can follow to do that:
Select File > Preferences... (or Arduino > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Set the path of the folder you want to use for the sketchbook folder via the "Sketchbook location" field in the "Preferences" dialog.
Click the "OK" button.
The "Preferences" dialog will close.
You may also wish to copy the contents of the folder at the previous sketchbook location to the folder at the location.