Is there a limit to the number of libraries?

Hi,

I am writing a sketch to compare a number of algorithms and, along the way, creating appropriate libraries to reduce the amount of code to scroll through in the sketch.

I have a weird problem.

I have the following declarations:

#include <Time.h>  
#include <Wire.h>  
#include <math.h>
#include <abc.h>             
#include <def.h>          
#include <ghi.h>

However, the classes and structs in the last library are not included and I get the usual 'Foo' was not declared in this scope error, where Foo resides in ghi.h

If I change the order to:

#include <Time.h>  
#include <Wire.h>  
#include <math.h>
#include <ghi.h>             
#include <def.h>          
#include <abc.h>

I now get a 'Bar' was not declared in this scope error, where Bar resides in abc.h. i.e, the last declared library.

Am I restricted to 5 libraries max? If not, what's the solution?

Thanks,
Ric

That is interesting. I'm sure there is no hard numeric limit to the number of include files one can use, other then of course the size of flash memory available to hold the total compiled code. I look forward to our software gurus to ferret your symptom out.

Lefty

You are correct. I think there are no hard-coded limits and my test was not sufficient to track down the error. Although the problem of the missing library appeared to be due to its position, there was an error in the .h file: a duplicate declaration/check of the #ifndef token resulted in those classes being skipped. Changing the order made the other library skip its token check.

If I had chosen a different library to swap with I might have got there sooner. Turning on verbose did the trick.

So easy to trip up isn't it?

Regards,
Ric

So easy to trip up isn't it?

Like wandering through a room full of black cats at midnight.