Skip to content

wrong placement of arduino.h #1310

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
holgerlembke opened this issue Mar 6, 2013 · 6 comments
Closed

wrong placement of arduino.h #1310

holgerlembke opened this issue Mar 6, 2013 · 6 comments
Assignees
Labels
Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation

Comments

@holgerlembke
Copy link

My code begins with something like that

#if defined(__AVR_ATtiny85__) 
  const int Pin0 = 0;
#else
  const int Pin0 = 4;
#endif 

byte something;

Compiling it for any none AVR_ATtiny85 leads to an error due to wrong arduino.h placement into the if-else part.

Adding a dummy declaration at the start (in front of #if) omits the error... but a real fix would be better.

@ghost ghost assigned ffissore Mar 6, 2013
@ffissore
Copy link
Contributor

ffissore commented Mar 6, 2013

Which version of the Arduino editor are you using? Can you provide the whole failing sketch?

@holgerlembke
Copy link
Author

IDE is 1.03 (latest download)

Select UNO as board, this creates the error

#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny84__)
const int Pin0 = 0;
#else
const int Pin0 = 4;
#endif


const byte pins[] = {
  Pin0};


void setup()
{
  // This code will only run once, after each powerup or reset of the board

}

void loop()
{
  // This code will loops consecutively

}

Of course works fine if the Attiny85 is selected.

@ghost ghost assigned Fede85 Mar 6, 2013
@ffissore ffissore added the New label Feb 27, 2014
@ffissore ffissore assigned ffissore and unassigned Fede85 Jan 28, 2015
@ffissore ffissore added the Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation label Jan 28, 2015
@ffissore
Copy link
Contributor

Please give a try to the IDEs linked at the bottom of this email on the dev list
https://groups.google.com/a/arduino.cc/forum/#!msg/developers/4X2T3rCxXWM/YNJl6PZuDucJ
We're testing a new preprocessor and it compiles your sketch just fine.

@ffissore
Copy link
Contributor

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

@holgerlembke
Copy link
Author

I'm too late for the test? The refered IDE links don't work anymore.

@ffissore
Copy link
Contributor

Not too late: take a look at the bottom of this page #2729

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
Projects
None yet
Development

No branches or pull requests

4 participants