Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Importing a library includes too many headers (Read 7256 times)
Makuna
Junior Member
**
Offline



Posts: 11
Importing a library includes too many headers
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.

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



Posts: 10395
United Kingdom
Re: Importing a library includes too many headers
Reply #1 - 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
Back to top
 
WWW  
IP Logged
 
Makuna
Junior Member
**
Offline



Posts: 11
Re: Importing a library includes too many headers
Reply #2 - 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.

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



Posts: 10395
United Kingdom
Re: Importing a library includes too many headers
Reply #3 - 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> 



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



Posts: 11
Re: Importing a library includes too many headers
Reply #4 - 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.

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



Posts: 10395
United Kingdom
Re: Importing a library includes too many headers
Reply #5 - 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.

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



Posts: 11
Re: Importing a library includes too many headers
Reply #6 - 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?
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10395
United Kingdom
Re: Importing a library includes too many headers
Reply #7 - 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.
Back to top
 
WWW  
IP Logged
 
Makuna
Junior Member
**
Offline



Posts: 11
Re: Importing a library includes too many headers
Reply #8 - 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. Angry

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



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