Skip to content

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

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
NicoHood opened this issue Feb 11, 2015 · 6 comments
Closed

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

NicoHood opened this issue Feb 11, 2015 · 6 comments
Labels
Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation Type: Duplicate Another item already exists for this topic
Milestone

Comments

@NicoHood
Copy link
Contributor

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.

@ffissore
Copy link
Contributor

I think this is a dup of #1518

@NicoHood
Copy link
Contributor Author

Wow. that bug is old. Why dont you (or anyone else) fix it? That really kills a lot of stuff and confuses a lot. I spent an hour to find out that my problem wasnt caused by me.

Any chance to get a fix now?

@ffissore ffissore added the Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation label Feb 11, 2015
@ffissore ffissore self-assigned this Feb 11, 2015
@ffissore
Copy link
Contributor

New preprocessor tracked at #2636. Builds for testing it are available

@NicoHood
Copy link
Contributor Author


Build options changed, rebuilding all

processing.app.debug.RunnerException
    at processing.app.debug.Compiler.compile(Compiler.java:352)
    at processing.app.debug.Compiler.build(Compiler.java:98)
    at processing.app.Sketch.build(Sketch.java:1159)
    at processing.app.Sketch.build(Sketch.java:1134)
    at processing.app.Editor$BuildHandler.run(Editor.java:1936)
    at java.lang.Thread.run(Unknown Source)
Caused by: processing.app.helpers.PreferencesMapException: pattern
    at processing.app.helpers.PreferencesMap.getOrExcept(PreferencesMap.java:255)
    at processing.app.preproc.IncludesFinder.preprocess(IncludesFinder.java:43)
    at processing.app.debug.Compiler.compile(Compiler.java:350)
    ... 5 more

When I try to compile it with my own hid core. Just pasted in my sketch above.

Didnt test that further. Just compile it for an external sketchbook core and it will crash.

@ffissore
Copy link
Contributor

Fixed by #3779

@ffissore ffissore added this to the Release 1.6.6 milestone Sep 11, 2015
@per1234 per1234 added the Type: Duplicate Another item already exists for this topic label Jul 1, 2017
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 Type: Duplicate Another item already exists for this topic
Projects
None yet
Development

No branches or pull requests

3 participants