Skip to content

#ifdef's ignored by the Arduino pre-processor, linking additional libraries. [imported] #906

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
cmaglie opened this issue Nov 15, 2012 · 2 comments
Assignees
Labels
Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation
Milestone

Comments

@cmaglie
Copy link
Member

cmaglie commented Nov 15, 2012

This is Issue 906 moved from a Google Code project.
Added by 2012-05-05T01:37:44.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium, Component-IDE

Original description

undef NOTDEF

ifdef NOTDEF

include <Wire.h>

endif

The I2C/TWI Wire library (in this example) still gets included even with the above code. In fact, any #include that begins at the start of a line causes the corresponding library to get loaded, even if the #includes are surrounded by /* and */ comment tokens on lines before and after the #include. This makes it more difficult to modularize code in memory-constrained environments.

What is the expected output?
The expected behavior is that any code or compiler directive should not be honored if it is part of a /* */ comment or #if/#ifdef code block that does not evaluate to true.

This behavior was observed on Arduino 1.0 running on Mac OS X 10.6.8.
It is not specific to any particular Arduino board.

@ffissore ffissore added the New label Feb 27, 2014
@ffissore ffissore added the Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation label Jan 27, 2015
@ffissore
Copy link
Contributor

Commented the original issue

@ffissore ffissore self-assigned this Jan 28, 2015
@ffissore
Copy link
Contributor

Fixed by #3779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation
Projects
None yet
Development

No branches or pull requests

3 participants