Go Down

Topic: Keeping all libraries in the sketch directory (Read 1 time) previous topic - next topic

adammhaile

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.

I've tried adding the header files to the sketch as a new tab, but that doesn't seem to work at all... don't even care if they should up in the arduino IDE.

Is this possible? And, if so, how to I include them in the main file for building?

PaulS

All .h files, all .cpp files, and all .pde files in the sketch directory are opened as separate tabs when you open the sketch.

All .pde files are compiled, so there is no reason to tell one .pde file about any others, nor is there a way to.

All .cpp files whose .h files are included in a .pde file will also be compiled. All the .o files that are produced by the compiler will be linked by the linker, to produce the .hex file.

Quote
I've tried adding the header files to the sketch as a new tab, but that doesn't seem to work at all.

It's always worked for me. What evidence can you show that "it doesn't seem to work at all"?

adammhaile

Evidence is that is says it cannot find the file...
However, I had all the libraries in their own sub-directories as well. Will this not work?

I'm used to in win32 C++ I can just include it as "#include "mylib/mylib.h" and it will follow to the subdirectory just fine. I guess it's just this that is not supported.  

For organization's sake I would really like to have the subdirectories if there is any way to keep them.

PaulS

Quote
Evidence is that is says it cannot find the file...

There is a difference between
#include <This.h>
and
#include "That.h".

Which were you using to cause the problem?

adammhaile

I tried both. Though, the file was in a subdirectory of the main sketch directory.  Are subdirectories supported at all?

PaulS

Quote
Are subdirectories supported at all?

Can't help you there. None of my Arduino projects are that involved that multiple directories under the sketch directory are needed.

bill2009

I believe the more recent arduino versions let you use a libraries folder in your sketchbook. Check the release notes.

Go Up