MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.28k stars 19.24k forks source link

[bugfix-2.0.x] Error compiling lcdprint_u8g.cpp redefinition of struct _uxg_fontinfo_t #12390

Closed brucehvn closed 5 years ago

brucehvn commented 6 years ago

Description

Downloaded the latest bugfix-2.0.x code on 10-Nov-2018. Rebased to get my config changes applied and tried to compile. I get the following output from the Arduino IDE:

"/home/bruce/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10803 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-I/home/bruce/.arduino15/packages/arduino/hardware/avr/1.6.20/cores/arduino" "-I/home/bruce/.arduino15/packages/arduino/hardware/avr/1.6.20/variants/mega" "-I/home/bruce/Arduino/libraries/U8glib/src" "/tmp/arduino_build_85356/sketch/src/lcd/lcdprint_u8g.cpp" -o "/tmp/arduino_build_85356/sketch/src/lcd/lcdprint_u8g.cpp.o"
In file included from /tmp/arduino_build_85356/sketch/src/lcd/lcdprint.h:16:0,
                 from /tmp/arduino_build_85356/sketch/src/lcd/lcdprint_u8g.cpp:24:
/tmp/arduino_build_85356/sketch/src/lcd/dogm/u8g_fontutf8.h:19:16: error: redefinition of 'struct _uxg_fontinfo_t'
 typedef struct _uxg_fontinfo_t {
                ^
In file included from /tmp/arduino_build_85356/sketch/src/lcd/lcdprint_u8g.cpp:23:0:
/tmp/arduino_build_85356/sketch/src/lcd/u8g_fontutf8.h:20:16: error: previous definition of 'struct _uxg_fontinfo_t'
 typedef struct _uxg_fontinfo_t {
                ^
In file included from /tmp/arduino_build_85356/sketch/src/lcd/lcdprint.h:16:0,
                 from /tmp/arduino_build_85356/sketch/src/lcd/lcdprint_u8g.cpp:24:
/tmp/arduino_build_85356/sketch/src/lcd/dogm/u8g_fontutf8.h:25:17: error: invalid type in declaration before ';' token
 } uxg_fontinfo_t;
                 ^
/tmp/arduino_build_85356/sketch/src/lcd/dogm/u8g_fontutf8.h:25:17: error: conflicting declaration 'typedef int uxg_fontinfo_t'
In file included from /tmp/arduino_build_85356/sketch/src/lcd/lcdprint_u8g.cpp:23:0:
/tmp/arduino_build_85356/sketch/src/lcd/u8g_fontutf8.h:26:3: note: previous declaration as 'typedef struct _uxg_fontinfo_t uxg_fontinfo_t'
 } uxg_fontinfo_t;
   ^
Using library U8glib at version 1.19.1 in folder: /home/bruce/Arduino/libraries/U8glib 

Steps to Reproduce

  1. Load Marlin code in Arduino IDE
  2. Click on Verify
  3. Code does not compile

Expected behavior: [What you expect to happen]

Code should compile normally

Actual behavior: [What actually happens]

Error during compilation listed above.

Additional Information

configfiles.zip

salfter commented 5 years ago

I'm running into the same issue building under PlatformIO...but only for an Arduino Due to be installed in a Hypercube 300. The same code builds without issue for an Arduino Mega in an Anet A8. Configs for both are attached.

config-anet-a8.zip config-hc300.zip

In file included from Marlin/src/lcd/lcdprint.h:16:0,
from Marlin/src/lcd/lcdprint_u8g.cpp:24:
Marlin/src/lcd/dogm/u8g_fontutf8.h:19:16: error: redefinition of 'struct _uxg_fontinfo_t'
typedef struct _uxg_fontinfo_t {
^
In file included from Marlin/src/lcd/lcdprint_u8g.cpp:23:0:
Marlin/src/lcd/u8g_fontutf8.h:20:16: error: previous definition of 'struct _uxg_fontinfo_t'
typedef struct _uxg_fontinfo_t {
^
In file included from Marlin/src/lcd/lcdprint.h:16:0,
from Marlin/src/lcd/lcdprint_u8g.cpp:24:
Marlin/src/lcd/dogm/u8g_fontutf8.h:25:17: error: invalid type in declaration before ';' token
} uxg_fontinfo_t;
^
Marlin/src/lcd/dogm/u8g_fontutf8.h:25:17: error: conflicting declaration 'typedef int uxg_fontinfo_t'
In file included from Marlin/src/lcd/lcdprint_u8g.cpp:23:0:
Marlin/src/lcd/u8g_fontutf8.h:26:3: error: 'uxg_fontinfo_t' has a previous declaration as 'typedef struct _uxg_fontinfo_t uxg_fontinfo_t'
} uxg_fontinfo_t;
^
compilation terminated due to -fmax-errors=5.
*** [.pioenvs/DUE/src/src/lcd/lcdprint_u8g.cpp.o] Error 1

Both are configured with the same type of display (Reprapdiscount Full Graphic Smart Controller). The A8 uses a RAMPS 1.4, while the Hypercube uses a RAMPS-FD 2.x.

wesk-ms commented 5 years ago

Latest 2.0.x downloaded yesterday fails to compile for me with the same errors.

Arduino Due Radds

In file included from sketch\src\lcd\lcdprint.h:16:0, from sketch\src\lcd\lcdprint_u8g.cpp:24: sketch\src\lcd\dogm/u8g_fontutf8.h:19:16: error: redefinition of 'struct _uxg_fontinfo_t'

typedef struct _uxg_fontinfo_t { ^

In file included from sketch\src\lcd\lcdprint_u8g.cpp:23:0: sketch\src\lcd\u8g_fontutf8.h:20:16: error: previous definition of 'struct _uxg_fontinfo_t' typedef struct _uxg_fontinfo_t { ^ In file included from sketch\src\lcd\lcdprint.h:16:0, from sketch\src\lcd\lcdprint_u8g.cpp:24: sketch\src\lcd\dogm/u8g_fontutf8.h:25:17: error: invalid type in declaration before ';' token } uxg_fontinfo_t; ^

sketch\src\lcd\dogm/u8g_fontutf8.h:25:17: error: conflicting declaration 'typedef int uxg_fontinfo_t' In file included from sketch\src\lcd\lcdprint_u8g.cpp:23:0:

sketch\src\lcd\u8g_fontutf8.h:26:3: error: 'uxg_fontinfo_t' has a previous declaration as 'typedef struct _uxg_fontinfo_t uxg_fontinfo_t'

} uxg_fontinfo_t; ^ exit status 1

boelle commented 5 years ago

@brucehvn problem solved?

boelle commented 5 years ago

@thinkyhead i think we can close this one

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.