Skip to content

IDE inserts an empty #include directive when the library.properties includes field is blank #7854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4dsystems opened this issue Aug 2, 2018 · 1 comment

Comments

@4dsystems
Copy link

4dsystems commented Aug 2, 2018

As per the readme, "includes - (available from IDE 1.6.10) (optional) a comma separated list of files to be added to the sketch as #include <...> lines. This property is used with the "Include library" command in the IDE. If the property is undefined all the headers files (.h) on the root source folder are included."

This doesn't seem to be compatible with the /src folder being used to store the library files, as if the include parameter is left blank, then the include statement in your Sketch has a blank #include <> instead of including all the .h files in the /src folder. It should look in src as well as root, surely?

I believe this to be a bug, or at least something which needs updating.

Reference:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format

@per1234
Copy link
Collaborator

per1234 commented Aug 2, 2018

By "undefined", it means there is no includes field in library.properties, not that there is an includes field but it was left blank. I have changed the specification wording to "missing". I think that makes the meaning more clear.

This doesn't seem to be compatible with the /src folder being used to store the library files, as if the include parameter is left blank, then the include statement in your Sketch has a blank #include <> instead of including all the .h files in the /src folder. It should look in src as well as root, surely?

"root source folder" is intended to mean the root of the folder that contains the source files. That's the src folder if the library is in 1.5 format or the library root folder if it's in 1.0 format. So it applies no matter what format the library is in. I'm not sure how that part of the specification could be better worded. Any suggestions are welcome.

If you have this line in your library.properties file:

includes=

and you do a Sketch > Include Library > {LIBRARYNAME}, The Arduino IDE will insert this line in your sketch:

#include <>

That happens regardless of which format the library is in.

I believe this to be a bug

Although you misunderstood the cause of the issue, I do agree that ideally the IDE code would be smart enough to realize that adding an empty #include directive will never be the correct thing to do and fall back to the behavior of a missing includes field when the includes field is blank.

@per1234 per1234 changed the title library.properties file, include parameter and /src folder IDE inserts an empty #include directive when the library.properties includes field is blank Aug 2, 2018
@cmaglie cmaglie closed this as completed in 3a3bc5b Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant