Call a library from a library.

Hello, I am programming a library in the user folder (ES: Documents\Arduino\libraries\lib1\lib1.h) inside it I want to call another one in the same space (ES: Documents\Arduino\libraries\lib2\lib2.h) or in the ide space (ES: .\arduino-0022\libraries\lib2\lib2.h). In both cases when I compile my code methot put in lib2 are not found. I include the library simply in this way:

#ifndef lib1_h
#define lib1_h


// include types & constants of Wiring core API
#include "WConstants.h"
#include "WProgram.h" //Arduino includes


#include <lib2.h>

If I put the include on the pde files of the lib1 test no error occour.
So, can anyone explain me how to include files from files included from a .pde?
I am used to implement libraries in c++, only with arduino I am having troubles.
Thanks in advance

If I put the include on the pde files of the lib1 test no error occour.
So, can anyone explain me how to include files from files included from a .pde?

The compiler compiles .cpp files ONLY for .h files included in the .pde file.

The IDE copies all the files to be compiled (.h and .cpp) to a different directory, first.

If you don't include a .h file in the .pde, the .h file doesn't get copied, so it can't be included in a .h or .cpp file that does get copied.

So, the answer to your question is fairly simple. Create your own make file for building and uploading the resulting hex file, or include all required .h files in the .pde file.

This question is asked (and answered) at least every other week. A search might heve proven useful.

thank you very much for your answer. before asking here I have searched a lot on google and in the forum for example writing "include libraries in libraries arduino" or "include header from header arduino" ecc... but I did not find what you answered me.
So arduino compliling process is very very stupid and not useful for complex (better not very small) projects.
Can you give me more information on the first solution "Create your own make file for building and uploading the resulting hex file"?
Are you speaking about using other ide like eclipse or is this an easier solution?
thanks!

So arduino compliling process is very very stupid and not useful for complex (better not very small) projects.

The process is relatively efficient. The way it is set up now allows you to edit a library using an external editor, save the changes, and test the changes in sketch, without having to remember to delete the .o files that were created from the library. So, for most applications, the current process is adequate.

Having to include the header file for a library in the sketch means that you can't hide the use of (and dependency on) another library from the users of your library.

There are many threads discussing the use of make files, and integration of the development process in eclipse. Search for something that works for you, if you don't like the current process.

thanks paulS