ropg / ezTime

ezTime — pronounced "Easy Time" — is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.
MIT License
327 stars 92 forks source link

[pio][stm32f103c8] Cannot compile, ezTime.h:70:2: error: redeclaration of 'ERROR' #76

Closed thomas-maurice closed 11 months ago

thomas-maurice commented 4 years ago

Hello !

I am trying to use the library on an stm32f103c8 (Bluepill) stm board using PlatformIO, it seems that the simple fact of including the library makes the compilation to fail because of a redefinition of the ERROR enum.

How to reproduce

platformio.ini:

[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_protocol = stlink
build_flags = -D EZTIME_ETHERNET
lib_deps =
    Ethernet
    ezTime

src/main.cpp:

#include <Arduino.h>
#include <ezTime.h>
#include <Ethernet.h>

void setup() {
}

void loop() {
}

Compilation log

Compilation log ``` :0:0: note: this is the location of the previous definition In file included from src/main.cpp:8:0: /home/thomas/.platformio/lib/ezTime_ID5751/src/ezTime.h:70:2: error: redeclaration of 'ERROR' ERROR, ^~~~~ In file included from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/stm32_def.h:28:0, from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/clock.h:43, from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring_time.h:23, from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring.h:38, from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/Arduino.h:32, from src/main.cpp:1: /home/thomas/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:167:3: note: previous declaration 'ErrorStatus ERROR' ERROR = !SUCCESS ^~~~~ In file included from /home/thomas/.platformio/lib/ezTime_ID5751/src/ezTime.cpp:3:0: /home/thomas/.platformio/lib/ezTime_ID5751/src/ezTime.h:70:2: error: redeclaration of 'ERROR' ERROR, ^~~~~ In file included from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/stm32_def.h:28:0, from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/clock.h:43, from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring_time.h:23, from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring.h:38, from /home/thomas/.platformio/packages/framework-arduinoststm32/cores/arduino/Arduino.h:32, from /home/thomas/.platformio/lib/ezTime_ID5751/src/ezTime.cpp:1: /home/thomas/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:167:3: note: previous declaration 'ErrorStatus ERROR' ERROR = !SUCCESS ^~~~~ /home/thomas/.platformio/lib/ezTime_ID5751/src/ezTime.cpp: In function 'void {anonymous}::triggerError(ezError_t)': /home/thomas/.platformio/lib/ezTime_ID5751/src/ezTime.cpp:51:45: warning: comparison between 'enum ezDebugLevel_t' and 'enum ErrorStatus' [-Wenum-compare] #define err(args...) if (_debug_level >= ERROR) _debug_device->print(args) [.... more warnings ....] ```

Do you have any idea how to fix that ? If you need more info feel free to ask !

Cheers