I talked to the author of Leptonica and this is not a bug. Leptonica is designed to be all or nothing with respect to headers. He says:
When including headers, use #include "allheaders.h" This includes all the headers for the library. You must also precede this with stdio.h and stdlib.h. So the header includes at the top of a source file are typically these: #include <stdio.h> #include <stdlib.h> #include "allheaders.h" See any of the source files in the library, as examples.

