Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Importing a library includes too many headers (Read 9060 times)
Makuna
Junior Member
**
Offline


Posts: 11
Joined: Jan 19th, 2015
Importing a library includes too many headers
Jan 22nd, 2015 at 7:59pm
Print Post  
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.

« Last Edit: Jan 22nd, 2015 at 9:41pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Importing a library includes too many headers
Reply #1 - Jan 22nd, 2015 at 9:05pm
Print Post  
Hi,

Thanks for the post. A few questions ...

How does the Arduino Ide handle libraries with multiple headers? 

Thanks
  
Back to top
WWW  
IP Logged
 
Makuna
Junior Member
**
Offline


Posts: 11
Joined: Jan 19th, 2015
Re: Importing a library includes too many headers
Reply #2 - Jan 22nd, 2015 at 9:13pm
Print Post  
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.

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Importing a library includes too many headers
Reply #3 - Jan 22nd, 2015 at 9:20pm
Print Post  
I think you are confused again.

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

Code
Select All
#include <Bridge.h>
#include <Console.h>
#include <FileIO.h>
#include <HttpClient.h>
#include <Mailbox.h>
#include <Process.h>
#include <YunClient.h>
#include <YunServer.h> 



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.
« Last Edit: Jan 22nd, 2015 at 9:20pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Makuna
Junior Member
**
Offline


Posts: 11
Joined: Jan 19th, 2015
Re: Importing a library includes too many headers
Reply #4 - Jan 22nd, 2015 at 9:35pm
Print Post  
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.

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Importing a library includes too many headers
Reply #5 - Jan 22nd, 2015 at 9:41pm
Print Post  
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.

Smiley
  
Back to top
WWW  
IP Logged
 
Makuna
Junior Member
**
Offline


Posts: 11
Joined: Jan 19th, 2015
Re: Importing a library includes too many headers
Reply #6 - Jan 22nd, 2015 at 10:26pm
Print Post  
Could you add a "clean import library" option that only includes the header that matches the same name as the library?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Importing a library includes too many headers
Reply #7 - Jan 23rd, 2015 at 4:48pm
Print Post  
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.
  
Back to top
WWW  
IP Logged
 
Makuna
Junior Member
**
Offline


Posts: 11
Joined: Jan 19th, 2015
Re: Importing a library includes too many headers
Reply #8 - Jan 23rd, 2015 at 6:28pm
Print Post  
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. Angry

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Importing a library includes too many headers
Reply #9 - Jan 24th, 2015 at 12:28am
Print Post  
Yes sorry, that is how Arduino works.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint