Go Down

Topic: #include paths for libraries (Read 13443 times) previous topic - next topic


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
Code: [Select]
#include <LibraryName.h>
The Arduino IDE is smart enough to append
Code: [Select]
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
Code: [Select]
-iquote/path/to/user/libs -I/path/to/arduino/libs and then include a library's header file like this?
Code: [Select]
#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 :-(

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. :)

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!

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131