Keeping all libraries in the Arduino sketch directory

Hi!

I know that you are supposed to place any external libraries under the "libraries" folder of the arduino install directory, but I have a project that uses several libraries that I have created for the project and mainly to keep all that code self contained and out of the main pde file. However, I have tried to place the libraries in the same directory as the main PDE file so that I can more easily keep everything synced up in subversion (I work on this on multiple computers) and I don't want to have to keep going back and syncing up the libraries separately. Also, just for the sake of being able to easily zip of the sketch folder and know that it contains everything it needs.

So, is this possible anyhow?

Hi tsaG

You can keep the library files in the same folder as the program. The include statement needs to use double quotation marks. For example:

#include "myAnimations.h"

I know that you are supposed to place any external libraries under the "libraries" folder of the arduino install directory

In the current version of the IDE, it is the standard libraries shipped with the IDE which are stored in the path of the Arduino executable, as per your comment.

But the IDE now allows you to store additional libraries in a folder under your default sketch folder. This is the preferred location for installing libraries from suppliers, for example. In the IDE, you can add them using Sketch - Import Library - Add Library. The default sketch folder can be checked in File - Preferences, and the libraries go into a folder called "libraries" under that.

The advantage is that the libraries in this folder are not affected if you reinstall or upgrade the IDE.

Regards

Ray

However, I have tried to place the libraries in the same directory as the main PDE file

Others will be along with advice but it sounds possible. Put the library files in the same folder as your sketch and use

#include "myLibrary.h"

instead of

#include <myLibrary.h>

Thanks, what about the folder for the library?

for example

#include ".../myFolder/myLibrary.h"

I suspect that it will not work but it will be easy for you to check.