Sketch fails to verify when adding u8glib

I’m trying to install Marlin on an ATmega 2560 board with a RepRapDiscount Full Graphic Smart Controller. I am trying to add these to my Anet A8. I am able to compile everything successfully if I leave the settings to the original screen, but the original screen doesn’t turn on when connected to the new board. I have tried using U8glib and U8g2, but neither works when I click verify. Here is the error message for u8g2 and below that is the message for u8glib. I’m sure I just don’t understand some simple thing, but I spent all day trying to figure it out and have no ideas. If anyone has any advice, I would greatly appreciate it!

Arduino: 1.8.7 (Windows 7), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

In file included from sketch\ultralcd_impl_DOGM.h:64:0,

from sketch\ultralcd.cpp:96:

ultralcd_st7920_u8glib_rrd.h:127:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x20); //non-extended mode

^

ultralcd_st7920_u8glib_rrd.h:128:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x08); //display off, cursor+blink off

^

ultralcd_st7920_u8glib_rrd.h:129:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x01); //clear DDRAM ram

^

ultralcd_st7920_u8glib_rrd.h:131:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x24); //extended mode

^

ultralcd_st7920_u8glib_rrd.h:132:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x26); //extended mode + GDRAM active

^

ultralcd_st7920_u8glib_rrd.h:133:7: error: expected unqualified-id before ‘for’

for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM

^

ultralcd_st7920_u8glib_rrd.h:133:19: error: ‘y’ does not name a type

for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM

^

ultralcd_st7920_u8glib_rrd.h:133:47: error: ‘y’ does not name a type

for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM

^

ultralcd_st7920_u8glib_rrd.h:141:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x0C); display on, cursor+blink off

^

ultralcd_st7920_u8glib_rrd.h:141:32: error: ‘display’ does not name a type

ST7920_WRITE_BYTE(0x0C); display on, cursor+blink off

^

ultralcd_st7920_u8glib_rrd.h:143:5: error: expected declaration before ‘}’ token

}

^

exit status 1
expected constructor, destructor, or type conversion before ‘(’ token

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Error message for u8glib

Arduino: 1.8.7 (Windows 7), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

In file included from sketch\ultralcd_impl_DOGM.h:64:0,

from sketch\ultralcd.cpp:96:

ultralcd_st7920_u8glib_rrd.h:127:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x20); //non-extended mode

^

ultralcd_st7920_u8glib_rrd.h:128:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x08); //display off, cursor+blink off

^

ultralcd_st7920_u8glib_rrd.h:129:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x01); //clear DDRAM ram

^

ultralcd_st7920_u8glib_rrd.h:131:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x24); //extended mode

^

ultralcd_st7920_u8glib_rrd.h:132:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x26); //extended mode + GDRAM active

^

ultralcd_st7920_u8glib_rrd.h:133:7: error: expected unqualified-id before ‘for’

for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM

^

ultralcd_st7920_u8glib_rrd.h:133:19: error: ‘y’ does not name a type

for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM

^

ultralcd_st7920_u8glib_rrd.h:133:47: error: ‘y’ does not name a type

for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM

^

ultralcd_st7920_u8glib_rrd.h:141:24: error: expected constructor, destructor, or type conversion before ‘(’ token

ST7920_WRITE_BYTE(0x0C); display on, cursor+blink off

^

ultralcd_st7920_u8glib_rrd.h:141:32: error: ‘display’ does not name a type

ST7920_WRITE_BYTE(0x0C); display on, cursor+blink off

^

ultralcd_st7920_u8glib_rrd.h:143:5: error: expected declaration before ‘}’ token

}

^

exit status 1
expected constructor, destructor, or type conversion before ‘(’ token

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

If there’s any additional information I need to post, let me know.

Those are all errors being reported against the libraries. Most of them suggest somethings missing. The errors are however, consistent with bad code, either a bad copy or a bad installation. There are other issues that may be at play, version 1.8.7 of the IDE has been revealing some inconsistencies. Try going back to the last 'stable' release 1.8.5 and see what happens.