Weird library errors

Hi,

I've been using the Arduino Beta 1.0 for a few months now for Android Open Accessory Kit-related development. It was working fine. Then all of a sudden today I have started getting the following errors when verifying my project - without having modified anything.

Even a simple empty sketch (with empty void,setup methods), where I include the following:
#include <AndroidAccessory.h>
#include <Max3421e.h>
#include <Usb.h>

Causes an 'error compiling' message as below:

In file included from ledmasterexample.cpp:1:
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:37:22: error: WProgram.h: No such file or directory
In file included from ledmasterexample.cpp:1:
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:44: error: 'byte' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:46: error: 'byte' has not been declared
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:46: error: 'byte' has not been declared
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:47: error: expected ';' before '(' token
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:48: error: 'byte' has not been declared
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:49: error: 'byte' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:50: error: expected ';' before '(' token
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:51: error: 'byte' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:52: error: 'boolean' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:53: error: 'boolean' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:56: error: 'byte' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:57: error: 'byte' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:58: error: 'byte' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:61: error: 'uint8_t' has not been declared
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:62: error: 'uint8_t' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:63: error: 'uint8_t' does not name a type
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h: In static member function 'static void MAX3421E::spi_init()':
C:\Users\Petteri\Desktop\petteri\Arduino\arduino-1.0-beta1\libraries\USB_Host_Shield/Max3421e.h:66: error: 'uint8_t' was not declared in this scope

The error message is much longer, so I only copied the first third or so.

All libraries are in the correct location as they can be seen by the IDE in "import library". I've re-installed all libraries fresh from accessories.google.com - but yet this error persists on every sketch (including the provided DemoKit example).

Again I stress that I have NOT modified the library files in any manner! What could be the issue here?

Please help, it is urgent!

Even a simple empty sketch (with empty void,setup methods), where I include the following:
#include <AndroidAccessory.h>
#include <Max3421e.h>
#include <Usb.h>

One of those libraries has not been updated for 1.0. With 1.0, the WProgram.h file was renamed to Arduino.h. Why is a mystery.

Thanks, I downloaded an extra package which had updated versions of those libraries and it worked. No idea why it reverted back to the non-updated version to cause this error.

xredebility, could you please link me to the extra package you downloaded to resolve those errors?

sorry for the late reply. This is a long time ago so I don't really remember how to solve it anymore. Here are a few solutions that may be correct:

  • This may sound stupid, but make sure that before you try to compile, you have selected the Arduino MEGA board from the boards menu. It will give strange errors on all the other boards except for the Mega board (if you are doing something similar to what I was doing). I remember i did this a few times and took me hours to figure out. This is assuming you are working with the ADK USB library, of course.

  • Update to the newest version of Arduino (minimum beta 1.0). Then inside some of the libraries you may get an error like " error: WProgram.h: No such file or directory" or something else associated with WProgram.h. That's because the libraries were coded for the old Arduino versions, which used WProgram.h for the core definitions. Nowadays it uses Arduino.h. So you have to manually go to each library and somewhere near the top, change this definition from WProgram.h to Arduino.h on the correct line in the library code - but only if you are using the Version 1.0 or newer of Arduino. NOTE: you cannot see Arduino.h or WProgram.h anywhere as they are part of Arduino's standard implementation (or something like that)

Other than that, I can't really remember how I solved it. I hope this helps.

EDIT