Error compiling for Arduino mega or 2560 message

Hey all,

I am trying to get my delta printer running but cannot get the Marlin to upload to the Ramps board.

I have chosen Mega 2560 as board and can upload the basic blink sketch no problems.

When I try to upload any version of Marlin form the net, I get the following message.

Error compiling for board Arduino/Genuino mega or 2560.

Here is the error code...

Arduino: 1.6.13 (Windows 8.1), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from sketch\MarlinConfig.h:37:0,

                 from sketch\Marlin.h:36,

                 from sketch\M100_Free_Mem_Chk.cpp:43:

D:\Arduino-delta\arduino-1.6.13\hardware\arduino\avr\cores\arduino/Arduino.h:235:2: error: #error "Targets with both UART0 and CDC serial not supported"

 #error "Targets with both UART0 and CDC serial not supported"

  ^

In file included from D:\Arduino-delta\arduino-1.6.13\hardware\arduino\avr\cores\arduino/Arduino.h:233:0,

                 from sketch\MarlinConfig.h:37,

                 from sketch\Marlin.h:36,

                 from sketch\M100_Free_Mem_Chk.cpp:43:

D:\Arduino-delta\arduino-1.6.13\hardware\arduino\avr\cores\arduino/USBAPI.h:152:16: error: conflicting declaration 'Serial_ Serial'

 extern Serial_ Serial;

                ^

In file included from D:\Arduino-delta\arduino-1.6.13\hardware\arduino\avr\cores\arduino/Arduino.h:232:0,

                 from sketch\MarlinConfig.h:37,

                 from sketch\Marlin.h:36,

                 from sketch\M100_Free_Mem_Chk.cpp:43:

D:\Arduino-delta\arduino-1.6.13\hardware\arduino\avr\cores\arduino/HardwareSerial.h:143:25: note: previous declaration as 'HardwareSerial Serial'

   extern HardwareSerial Serial;

                         ^

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I have tried changing the board type to my ramps 1.4 and leaving it as downloaded from various sites but no good.

Any help appreciated.

Greg

This is NOT an Arduino problem. It belongs on the RepRap forum.

Arduino.h is declaring an error at line 235.

#ifdef __cplusplus
#include "WCharacter.h"
#include "WString.h"
#include "HardwareSerial.h"
#include "USBAPI.h"
#if defined(HAVE_HWSERIAL0) && defined(HAVE_CDCSERIAL)
#error "Targets with both UART0 and CDC serial not supported"
#endif

It looks like HAVE_HWSERIAL0 and HAVE_CDCSERIAL are both defined somewhere.

HardwareSerial.h has:

#if defined(UBRRH) || defined(UBRR0H)
  extern HardwareSerial Serial;
  #define HAVE_HWSERIAL0
#endif

USBAPI.h has:

#define HAVE_CDCSERIAL

It looks like anyone compiling on the MEGA would get this error! The UBRRH if the high half of the UART Baud Rate Register for older chips with only one UART. UBRR0H is the same for the first UART on chips with more than one UART.

Thanks for the reply. So if i just undefine 1 of those it should work. Which one. I'll try that this arvo.

Thanks.
Greg