Today I tried to build a little library to manage many buttons. Within my button.cpp file I use a function(TIMER0_getTimeStamp) which comes from my home made Timer0 library. So in my button.h I include my timer0.h, and in my main since I do not need to explicitely use any of my timer0 functions I only include button.h.
I get an error message telling me that 'TIMER0_getTimeStamp' was not declared in this scope. After playing a bit with the include statements I found that if I include timer0 in my main everything works, but why is that?
I thought it was possible to include an use a library within an other library without having to define it in the main file?
Here is my include statements
main file :
#include <button.h> #include <utils.h> #include <uart.h>
#ifndef BUTTON_H_ #define BUTTON_H_ #define true 1 #define false 0 #include <avr/io.h> #include <avr/interrupt.h> #include <timer0.h>
If my question is not clear enough I can paste all my code, but since it does not seem to relate to the code per say I did not include it for sake of shortness.
Thanks you all