#include paths for libraries

Sorry if this has already been answered elsewhere; I searched and Google'd without success.

The pattern for including a library's header file is

#include <LibraryName.h>

The Arduino IDE is smart enough to append

-I/path/to/libs/LibraryName

to the GCC command for every library included. This works, but doesn't feel natural, and requires doing some fancier footwork when you want to build an Arduino sketch via a Makefile.

Instead, wouldn't it be better to pass -iquote/path/to/user/libs -I/path/to/arduino/libs and then include a library's header file like this?

#include "LibraryName/LibraryName.h"

It should still be very simple for newbies to grok, but would make the transition to a Makefile simpler.

Makefile complexity always grows to the point where no one person understands them anymore. Past that, actually :frowning:

Your suggestion makes sense given the way that Arduino libraries are currently constructed, but that is a relatively recent structure. Go back a few versions and it was common for "official" arduino libraries to be off in .../hardware/... and user-installed libraries to be in "unspecified" locations all over the disk. Including a full path to each include file is maximally flexible, and the verbosity of the resulting gcc command isn't really relevant.

True, but complexity can be managed. :slight_smile:

Regardless of where the libraries are, the IDE knows about them. Regardless of how many search paths there are, they can always be specified with -I or -iquote and done once, versus having to add -I for every library included in the project.

#include "LibraryName/LibraryName.h"

Too complicated for the target audience too. As is, the complexity is hidden by the IDE. Tough luck on makefile users, but they're supposed to know what they're doing!