Pages: [1]   Go Down
Author Topic: Keeping all libraries in the sketch directory  (Read 1764 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 644
Posts: 50505
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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"?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 644
Posts: 50505
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 644
Posts: 50505
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

ottawa, canada
Offline Offline
God Member
*****
Karma: 6
Posts: 993
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Bill Rowe
Olduino - An Arduino for the First of Us
www.olduino.wordpress.com

Pages: [1]   Go Up
Jump to: