VS Arduino
>> >> Importing a library includes too many headers
https://www.visualmicro.com/forums/YaBB.pl?num=1421956790

Message started by Makuna on Jan 22nd, 2015 at 7:59pm

Title: Importing a library includes too many headers
Post by Makuna on Jan 22nd, 2015 at 7:59pm
When I import a library (project menu, add/import sketch library), it includes a whole selection of headers (dependent?) rather than just the library header.  There is no need for this.

In one case I had, the order was defined in the primary library header specifically, but this import included it out of order and it failed to build.  It was an easy fix, remove the extra includes in my ino; but importing should not be doing this.  I am sure it would be confusing to someone who has less knowledge than I do.


Title: Re: Importing a library includes too many headers
Post by Visual Micro on Jan 22nd, 2015 at 9:05pm
Hi,

Thanks for the post. A few questions ...

How does the Arduino Ide handle libraries with multiple headers?

Thanks

Title: Re: Importing a library includes too many headers
Post by Makuna on Jan 22nd, 2015 at 9:13pm
It includes the primary header (same name as the library) and expects the library owner to include dependent headers in that primary header.

An example, look at SDFat library available out there.  When you include it, the Arduino IDE will then insert #include <SdFat.h> in your Ino.  Inside SdFat.h you will find the includes in order as required by the library.


Title: Re: Importing a library includes too many headers
Post by Visual Micro on Jan 22nd, 2015 at 9:20pm
I think you are confused again.

If I include the Bridge library then the Arduino Ide includes this:-

[code]#include <Bridge.h>
#include <Console.h>
#include <FileIO.h>
#include <HttpClient.h>
#include <Mailbox.h>
#include <Process.h>
#include <YunClient.h>
#include <YunServer.h>[/code]

So how do you explain that?

Can you please tell me the names of the .h files in the SDFat folder that were not #included by the Arduino Ide?

Library authors can place .h files to be ignored by the "import" in a lib/utilities folder or with arduino 1.5 in sub folders below each libary folder.

Title: Re: Importing a library includes too many headers
Post by Makuna on Jan 22nd, 2015 at 9:35pm
Ok, I am confused.  This is what it was doing a month or so ago.  I built a bunch of examples and I never got the extra header files. 

But as of right now, I am getting EVERY header from library when there is absolutely no need and makes the code overly verbose and confusing for beginners.

When I installed VisualMicro, it couldn't effect how the Arduino IDE works could it?

I don't believe I updated the Arduino IDE since then, but I could have.


Title: Re: Importing a library includes too many headers
Post by Visual Micro on Jan 22nd, 2015 at 9:41pm
Okay that good to hear. You had me worried for a minute.

No, Visual Micro can not affect the Arduino Ide and yes, the Arduno Ide has always worked that way.

:)

Title: Re: Importing a library includes too many headers
Post by Makuna on Jan 22nd, 2015 at 10:26pm
Could you add a "clean import library" option that only includes the header that matches the same name as the library?

Title: Re: Importing a library includes too many headers
Post by Visual Micro on Jan 23rd, 2015 at 4:48pm
I'll give it some thought. The problem is that if it doesn't do the same as Arduino it causes so much more support.

Title: Re: Importing a library includes too many headers
Post by Makuna on Jan 23rd, 2015 at 6:28pm
I just found out why they do it.

I am getting undefined method when one library header includes the header of another library but the INO doesn't list that dependent library.

It seems the Arduino IDE is using the defines in the INO as a means of listing obj dependencies rather than building it from included files. >:(


Title: Re: Importing a library includes too many headers
Post by Visual Micro on Jan 24th, 2015 at 12:28am
Yes sorry, that is how Arduino works.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.