Go Down

Topic: possible to #include files outside /libraries and sketch folder ? (Read 432 times) previous topic - next topic

steve_n

Hi all,

Say I have three Arduino sketches that all rely on the same library or libraries.  I am actively working on both the .INOs and the libraries, and its a ton of code, so they need to be tightly synced on Github.  Putting the libraries in the Arduino/libraries folder and using two or more separate repositories is going to get messy and disorganized fast.  So the file structure should be something like:

/main/SharedClass.h
/main/SharedClass.cpp
/main/Sketch1/Sketch1.ino
/main/Sketch2/Sketch2.ino
/main/Sketch3/Sketch3.ino

How do I include SharedClass.h in my sketches?  #include "../SharedClass.h" doesn't seem to work. 

Any thoughts?  Is there a straightforward solution here?  How are people organizing their similar projects?  Any help is appreciated.

retrolefty

Well I'm very much a classless knowledgeable software type (bad pun?), but might one be able to add the class .h and .cpp stuff into tabbed sections of the user's sketch that you don't want to have included from the common users library?

Lefty

hilukasz

had a similar problem, apparently you need to add:

Code: [Select]
#include "Arduino.h"

to you header files.
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

steve_n


Well I'm very much a classless knowledgeable software type (bad pun?), but might one be able to add the class .h and .cpp stuff into tabbed sections of the user's sketch that you don't want to have included from the common users library?


Thanks, but I'm not 100% sure I'm following.  Are you suggesting I add the class files into each sketch?  If I did that, I would have to copy and paste the most recent files into every sketch folder every time I wanted to compile, which would be messy and cumbersome.  If I missed your point, please do clarify, I really would like to figure this out...

steve_n


had a similar problem, apparently you need to add:

Code: [Select]
#include "Arduino.h"

to you header files.


Hey thanks for responding.  Can you confirm you actually have this working?  I actually already have #include "Arduino.h" in all my header files. 

Just to be clear, you're saying that, as in my example in the first post, adding #include "Arduino.h" to SharedClass.h will allow it to be included to Sketch1.ino with #include "../SharedClass.h" ?  Unless I'm missing something else, that isn't working for me...

Go Up