Closed GoogleCodeExporter closed 9 years ago
I've seen issues with some of the macros in WProgram.h and standard header
files like
<stdlib.h>. If you include stdlib.h after WProgram.h has been included, you'll
get
hard to figure-out compilation errors. I'd love to see WProgram implicitly
included
through the command line, but it would be good to clean it up so it's a good
citizen
with the standard library first.
Original comment by ben.combee
on 22 Dec 2009 at 10:33
I just had to work around an error caused by this problem. My code has an
#ifdef near the beginning which includes a variable declaration inside the
conditional code block. If I didn't define the constant, then the IDE-inserted
#include was incorrectly inserted inside that block, and consequently never
compiled in the first place. For example:
--- START CODE ---
//#define ENABLE_PS2
//#define ENABLE_USB
//#define ENABLE_BLUETOOTH
#ifdef ENABLE_PS2
#include "ps2keyboard.h"
#define KB_PIN_CLOCK 3
#define KB_PIN_DATA 2
PS2keyboard *keyboard;
#endif
--- END CODE ---
I was able to easily work around this so the program compiled as expected by
changing my code to include a dummy variable up above, like so:
--- START CODE ---
unsigned char ide_workaround = 0;
//#define ENABLE_PS2
//#define ENABLE_USB
//#define ENABLE_BLUETOOTH
#ifdef ENABLE_PS2
#include "ps2keyboard.h"
#define KB_PIN_CLOCK 3
#define KB_PIN_DATA 2
PS2keyboard *keyboard;
#endif
--- END CODE ---
Easy, but it should be unnecessary, and I wouldn't have known to try it if not
for other posts in the Arduino forums. They said the regexes responsible for
figuring out where to put the #include directive weren't totally reliable.
Original comment by jeffrowb...@gmail.com
on 6 Oct 2010 at 3:42
Including WProgram.h via command line doesn't solve the problem, another very
similar issue but with a more complete test case is here:
https://github.com/arduino/Arduino/issues/2630
Closing as duplicate.
Original comment by c.mag...@arduino.cc
on 27 May 2015 at 10:25
Original issue reported on code.google.com by
dmel...@gmail.com
on 22 Dec 2009 at 9:47