Fix for "#include Arduino.h"

A lot of libraries seem to want to use #include “Arduino.h”. A simple solution that has worked for me (so far, it seems) is replacing it with:

#define ARDUINO_H
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>

This may not work in all cases, but it has compiled for me thus far. The libraries I’m attempting to port don’t seem to complain after I paste in this fix.

5 Likes

Thanks! This works for me. I have the Arduino PID library up and running.

Or you could remove the #include "Arduino.h" entirely. All the std*.h libraries are included by default.

Actually there are a lot of things inside Arduino.h that programs need… and Spark hasn’t implemented them all. Lot’s of macros. See here: