Description
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:
- Please add the option to add or remove project wide defines, which all .H and .CPP files associated with included libraries will be guaranteed to be able to detect, with ordinary #ifdef directives.
- A manual menu or IDE option to force a complete rebuild will aid in making this kind of per/project library customization work.