Arduino Compile Error

Compile/Build Errors in Arduino 0023 on Ubuntu

For a while now I’ve been getting build errors in Arduino-0023 on Ubuntu, so I took the easy way out and used Arduino-0023 on Windows because it worked. Finally I got around to investigating the issue, and thanks to Google have found a solution.

The error:

In file included from /usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:44:0,
from /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/delay.h:37,
from /home/hannah/Documents/Software/Arduino_Linux/arduino-0023/hardware/arduino/cores/arduino/wiring_private.h:30,
from /home/hannah/Documents/Software/Arduino_Linux/arduino-0023/hardware/arduino/cores/arduino/WInterrupts.c:34:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected identifier or ‘(’ before ‘double’
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected ‘)’ before ‘>=’ token

The solution:

Comment out line 79 of <arduino installation directory>/hardware/arduino/cores/arduino/wiring.h:

//#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 

An alternative solution wraps the #define round(x)... line with a check for the problematic version of avr-libc:

#if __AVR_LIBC_VERSION__ < 10701UL
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#endif

Leave a Reply

Your email address will not be published. Required fields are marked *