Hello. I've just gotten started with Arduino and I have run into an odd problem. I put together a Danger Shield tonight and tried to load one of the example sketches for it. I received the following errors:
\LOCALS~1\Temp\build20730.tmp\/_init.h: In function 'void ds_init()':
\LOCALS~1\Temp\build20730.tmp\/_init.h:31: error: 'INPUT' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:31: error: 'pinMode' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:36: error: 'OUTPUT' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:49: error: 'HIGH' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:49: error: 'digitalWrite' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:56: error: 'LOW' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:57: error: 'MSBFIRST' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:57: error: 'shiftOut' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:61: error: 'byte' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:61: error: expected `;'before 'i'
\LOCALS~1\Temp\build20730.tmp\/_init.h:61: error: 'i' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:64: error: 'delayMicroseconds' was not declared in this scope
\LOCALS~1\Temp\build20730.tmp\/_init.h:81: error: 'Serial' wasnot declared in this scope
In function 'void loop()':
However, when I commented out the #include "_init.h" and pasted the contents of _init.h into the main sketch, I did not get the errors on compile. What might be causing this? Obviously the code works since it compiled properly as part of the sketch file. I am stumped as to what is causing the errors in the header file. Any help would be greatly appreciated.
I hadn't even thought of trying it on an older version. I got these errors with 12, but I installed 11 and it compiles fine. I don't think the code is the issue here. Is there a bug reporting page for the Arduino IDE?
Good day. I just got into this, and am having the same issue.
Didn't see anything in the bugs thread on this.
The question is: why is this happening? Another newbie (to Arduino) here, but a seasoned java programmer w/some c experience.
I don't wanna fall back to an older version of the compiler - i wanna fix the code from Zach...
I shall start probing around in the cpp and .h files - my initial inkling is that this is probably due to some changes made to the language/compiler having to do with prototypes/declarations?
One thing I see in the Arduino examples is keywords.txt - i don't see this in the danger shield examples...any thoughts?
I got the danger shield examples from sourceforge.
see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1224864760/10#10 for a solution. Adding #include "WProgram.h" to the _init.h file fixes the issue when using 12. edit I see mellis beat me to referencing the answer he gave me before. You're awesome, mellis. Thanks for your help!
Strange, this seems to be a different problem and its not solved by including "WProgram.h" in _init.h (at least in the test I ran). The errors mentioned in the other thread were due to the casting macros. The errors posted here are due to missing prototypes.
#include "WProgram.h" in the sketch itself does fix this issue.
Just an fyi - for a quick fix, open _init.h (or any/all of your .h files), and copy the code from the .h file(s) into the .pde, then save, compile, upload to the board - works fine for me.
This must be a library path issue with 12. It sure would be nice to get a doc on this compiler exe.
Can we compile and upload to a board using Eclipse?