Skip to content
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

Please add a way to include project wide #defines within the IDE #1837

Closed
thepixy opened this issue Jan 26, 2023 · 1 comment
Closed

Please add a way to include project wide #defines within the IDE #1837

thepixy opened this issue Jan 26, 2023 · 1 comment
Assignees
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@thepixy
Copy link

thepixy commented Jan 26, 2023

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:

  1. 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.
  2. A manual menu or IDE option to force a complete rebuild will aid in making this kind of per/project library customization work.
@per1234 per1234 transferred this issue from arduino/Arduino Jan 27, 2023
@per1234 per1234 self-assigned this Jan 27, 2023
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jan 27, 2023
@per1234
Copy link
Contributor

per1234 commented Jan 27, 2023

Hi @thepixy. Thanks for taking the time to submit this suggestion.

I see we already have quite a few previous requests for this in various forms, including:

So I'll close this as a duplicate. It is already possible to do what you propose if you are using the advanced tool Arduino CLI. If you would like assistance with using Arduino CLI, just post on the Arduino Forum:

https://forum.arduino.cc/c/software/arduino-cli/89

I'm sure we'll be able to help you out over there.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 27, 2023
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Jan 27, 2023
@arduino arduino locked as resolved and limited conversation to collaborators Jan 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

2 participants