Skip to content

preprocessor issue when "{" is present #4118

Closed
@qbahn21

Description

@qbahn21

Arduino 1.6.6 and 1.6.7:
Try to compile this sketch for an AVR board. It results in a compilation error: "'f2' was not declared in this scope".

ifdef SAM3X8E // Arduino Due compatible

void fake()
{
}

else

void fake ()
{
}

endif

void f1(){ f2(); }
void f2(){;}

void setup() {
}
void loop() {
}

But when lines 3 and 4 are commented out like this:

ifdef SAM3X8E // Arduino Due compatible

void fake()
//{
//}

else

...
the sketch compiles just fine. Why does a code that shouldn't be included prevents a compilation?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions