Compiling Error for DUE, but not for MEGA ?

Hello,
i will update a sketch from a MEGA to my new DUE...

But i have the following error (IDE 1.5.2):

In file included from c:\programme\arduino-1.5.2\hardware\tools\g++_arm_none_eabi\bin../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:21,
from C:\Programme\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Arduino.h:23,
from C:\Programme\arduino-1.5.2\hardware\arduino\sam\variants\arduino_due_x/variant.h:26,
from C:\Programme\arduino-1.5.2\hardware\arduino\sam\libraries\SPI/SPI.h:14,
from THS_DUE_2013_002.ino:148:
c:\programme\arduino-1.5.2\hardware\tools\g++_arm_none_eabi\bin../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/sys/reent.h:490: error: #if with no expression

The same sketch can i compile without errors in the same IDE for a MEGA.

many thanks,
paulinchen

c:\programme\arduino-1.5.2\hardware\tools\g++_arm_none_eabi\bin../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/sys/reent.h:490: error: #if with no expression

The Error is outside of your sketch. Head honcho g++ tells you that the file reent.h which is to be used for compiling code for the SAM3X is botched. So the message ensues. Have you messed in this file before?
This file is not used for the Atmega Mega so no error occur.

Hope this helps,

Transistorfips

I made no changes in the Files. Only install the IDE. :astonished:

paulinchen

This is the code of reent.h of Ver.1.5.2

Line 489..495 states:
/* Only built the assert() calls if we are built with debugging. */

if DEBUG

include <assert.h>

define __reent_assert(x) assert(x)

else

define __reent_assert(x) ((void)0)

endif

If the touch-stone "DEBUG" is omitted the compiler grumbles. Maybe a bug in your version because this feature hasn't been fully tested.

Hallo Transistorfips,
vielen Dank für Deine Hilfe.

Ich hatte bei mir im Sketch auch ein #define DEBUG drin, allerdings ohne anschliessenden Wert.

Nach der Änderung von

#define DEBUG

in

#define DEBUG true

wird der sketch jetzt fehlerfrei compiliert.

Vielen Dank und ein schönes Wochenende.
paulinchen

Interesting, seems to be a bug in the GCC code, reent.h should have "#ifdef DEBUG"?

I'm slightly puzzled as to why this problem does not occur more often, it seems like it should happen whenever DEBUG is not defined.