Skip to content

transformation .ino to .cpp fails with multi-line macro definition #1971

Closed
@peabo7

Description

@peabo7

This code is not properly transformed from .ino to .cpp; the line containing "0" is erroneously emitted right after the #include "Arduino.h" statement resulting in a diagnostic such as:

buggy.ino:5: error: expected unqualified-id before numeric constant

Rewriting the macro "abc" so it fits on one line avoids the problem. Note also that the line number referenced in the error message is not the line number of the macro definition or the expansion, making it difficult to find what is wrong in a large program.

 #define abc \
 0

 void
 setup()
 {
   abc;
 }

 void
 loop()
 {
 }

I saw this using1.5.6-r2 BETA, but have not tested it on previous versions.

Peter Olson

Metadata

Metadata

Assignees

Labels

Component: PreprocessorThe Arduino sketch preprocessor converts .ino files into C++ code before compilation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions