-
-
Notifications
You must be signed in to change notification settings - Fork 7k
#if bug #1468
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
Comments
What kind of error does this give? The code looks good to me? |
just copy-paste the following code to the ide #ifdef __AVR_ATtinyX5__
const byte LED_PIN = 3; // gamba 2
const byte RECV_PIN = 1; // gamba 6
#else
const byte LED_PIN = 3;
const byte RECV_PIN = 10;
#endif
void setup(){
}
void loop(){
} compile for any board and you'll get (also tryed with uint8_t):
|
I was going to say that this error doesn't seem related to the #if and you just forgot an include, but the autogenerated #include "Arduino.h" should take care of including/defining those types. Trying this in the Arduin IDE (1.0.3) confirms the problem. If I remove the #if construct, the code compiles as expected. Looking at the .cpp file the IDE generates from this .ino file, I find it starts with:
In other words: The bug is that the IDE inserts the #include after the #if, for some reason. I'm not familiar with the code to find out why this happens, but I guess someone else can take it from here :-) In the meanwhile, as a workaround you can put some code above the #if statement to make it compile (e.g., something like If anyone is looking into this: Perhaps it would be worthwhile to use gcc's -include option to add the Arduino.h include instead of putting it in the generated file? |
Please give a try to the IDEs linked at the bottom of this email on the dev list |
New preprocessor tracked at #2636. Builds for testing it are available |
Fixed by #3779 |
give error. declaring a variable before #if resolve the problem.
bug found by nid69ita
The text was updated successfully, but these errors were encountered: