Please add a way to include project wide #defines within the IDE #1837
Labels
conclusion: duplicate
Has already been submitted
topic: code
Related to content of the project itself
type: enhancement
Proposed improvement
Problem: #defines in a sketch are only visible in subsequently #included .H files, but are not visible in library .CPP files associated with the included .H files.
Why it matters: I would like to be able to save code space by adding "#ifdef/#endif" constructs to library files, which would allow me to include or exclude code in that library from the project build. Unfortunately this is not possible in the typical case where a library contains both .H and .CPP files. #define(s) added to the top of a sketch will certainly be visible in .H files #included after the define(s). But they will not be visible in the .CPP file associated with the library's .H file! Even convoluted constructs where an included .H file responds to a defined identifier by creating another identifier will not result in the .CPP file being aware of those defines. This is especially true once the sketch has been compiled, because if there are no detected changes in the library's .CPP file, the source will be ignored in favor of the created object (.O) file.
Solutions requested:
The text was updated successfully, but these errors were encountered: