Go Down

Topic: Build errors in math.h when building BlinkWithoutDelay example (Read 8 times) previous topic - next topic

greengiant83

I just bought an arduino uno and installed the ide on my ubuntu 11. I have the arduino plugged into the laptop via usb and I loaded the BlinkWithoutDelay example and tried to upload it to the board.  I am getting these compiler errors.

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/mbell/Downloads/arduino-0023/hardware/arduino/cores/arduino/wiring_private.h:30,
                 from /home/mbell/Downloads/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


I feel fairly confident that neither Math.h or the example program are to blame, so I assume it is a configuration issue.  Any ideas what the issue might be?

SurferTim

#1
Nov 18, 2011, 01:25 pm Last Edit: Nov 18, 2011, 02:37 pm by SurferTim Reason: 1
I know exactly where it is. That is in /usr/share/arduino/hardware/arduino/cores/arduino/wiring.h

There is a define that causes grief. I think it is around line 79 in that file you will find a "#define round" macro. You need to comment it out like this:
Code: [Select]
// #define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

It tries to replace the declaration of round in the math.h header file (line 426) and causes that compiler error.

Edit: Oops! I didn't know exactly where it is in YOUR install.  :smiley-red:
/home/mbell/Downloads/arduino-0023/hardware/arduino/cores/arduino/wiring.h

This is due to the upgrades I suggested back in August. The avr-gcc-1.7.1 delay.h file was missing the "#include <math.h>", so I would get a "no declaration for fabs and ceil" error. But when I added that include file, then I got the error you are getting now. The Ubuntu repository has both my bug fixes. That version of Arduino obviously does not.


greengiant83


SurferTim

The Arduino crew was notified that this was happening, and offered a fix, which they have yet to implement. Read the comments here:
http://code.google.com/p/arduino/issues/detail?id=604&start=200

Go Up