Skip to content

1.6 Include Arduino.h differs if global int was used #2622

Closed
@NicoHood

Description

@NicoHood

Its a very weird bug. Feel free to edit the name of the issue, I had no better idea.

The Arduino include definition works after a global int was placed in the sketch. it does not work if it is above. If i force the include it works. Simply try the following code and comment the integer:

//#include "Arduino.h"

#ifdef Arduino_h
#error
#endif

int nowincludingbewlo = 2;

#ifdef Arduino_h
#error
#endif

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Can anyone explain me why this happens, so I can at least continuing developing without being afraid that the next bugfix will break my stuff? This confused me a lot and also caused my sketch to now work anymore for some reason. Using new 1.6 with Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: PreprocessorThe Arduino sketch preprocessor converts .ino files into C++ code before compilationType: DuplicateAnother item already exists for this topic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions