#include in own libraries

Hi there.
I have a problem with libraries, and can’t get it run.
I want to make a library, which contains a lot of functions AND should include other libraries.
But i completly get confused, where the compiler searches for the files.
I looked into some standardlibrarycode… and it seems, that they don’t do it different…
To keep it simple, i broke everything down:

Main Code:

#include "inci.h"
void setup() {
}
void loop() {
}

Library, named inci.h: like this it works fine

#define A B

Library, named inci.h: like this it does not find EEPROM.h

#include <EEPROM.h>

Of couse it works, if i put everything in one file…

I keep the inci.h in the same folder as the mainprogram. But putting it in the arduino’s libraryfolder does change anything. (and by changing the “inci.h” to a <inci.h>)

So, how do i specify the path, where he should search for includes?

This is a limitation of the Arduino IDE…

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1242850338
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1255235742
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1256874738

oooh, thanks a lot. i read hour by hour in Cpp-library-examples, and tutorials and a lot of stuff. But i didn’t search right here properly…

OK, i get, that the IDE-preprocessor just includes what's directly in my pde. But in the libraries are often "#includes". Mainly the "linking" between .cpp and the .h But sometimes others too: the ethernet.h library includes "server" and "client".

Maybe somebody can somebody point out the difference between this and my try!

And: would it be possible, to put the complete content of "EEPROM.h" (and others i need) in my library? (corrected and with the corresponding .cpps)

But in the libraries are often "#includes". Mainly the "linking" between .cpp and the .h But sometimes others too: e.g. the ethernet.h library includes "server" and "client".

These libraries include files which are either in the same directory or in a subdir named "utility" (the name is mandatory).

But in your own library it would not be possible to include for instance the ethernet-lib (or individual files from this directory). That's the limitation explained in the links.

OK, i get, that the IDE-preprocessor just includes what's directly in my pde.

Its the same for libraries (with the exception of the files in the "utility" subdir).

Eberhard

And: would it be possible, to put the complete content of "EEPROM.h"

This seems to work...

#include "..\EEPROM\EEPROM.h"

(corrected and with the corresponding .cpps)

The only way to get the dot-cpp files included is to add the header to the Sketch.

Ui, thanks.

This works? confirmed :wink: at least, if my lib is in the lib-folder

#include "..\EEPROM\EEPROM.h"

Strange, i tried several versions of it, while guessing from where i have to go up directories… not knowing the reference point. Maybe i missed that one.

Just as a writeup for others facing my problem:
It just works too, when i put the libraryfiles i want to include with my library in the directory of the library i create. (Just tried it out with EEPROM.h until now)
Not a elegant solution, but more elegant than having 5 Libraries to be includes before it’s allowed to include my library.