PaulStoffregen / Time

Time library for Arduino
http://playground.arduino.cc/code/time
1.24k stars 664 forks source link

Issues compiling library with Arduino WEB IDE #167

Open I020006 opened 2 years ago

I020006 commented 2 years ago

Description

I use the TimeLib 1.6.1 in my local Arduino IDE 1.8.16 and it does compile fine with my local installation. If I use the same code, in the Arduino Cloud Editor, I get the following compilation errors - compiling it for the NodeMCU1.0 (ESP_12-E Module):

/usr/local/bin/arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2:baud=115200,dbg=Disabled,eesz=4M,exception=disabled,ip=lm2f,lvl=None____,vt=flash,wipe=none,xtal=80 --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/680303245/build --build-path /tmp/arduino-build-001A81F5F621F992EC5DD8B712941CC8 /tmp/680303245/MyWortuhr_V05 Using library time_1_6_1 at version 1.6.1 in folder: /home/builder/opt/libraries/time_1_6_1 Using library adafruit_neopixel_1_10_0 at version 1.10.0 in folder: /home/builder/opt/libraries/adafruit_neopixel_1_10_0 In file included from /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/tools/sdk/libc/xtensa-lx106-elf/include/string.h:163:0, from /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/cores/esp8266/Arduino.h:33, from /home/builder/opt/libraries/latest/time_1_6_1/DateStrings.cpp:12: /home/builder/opt/libraries/latest/time_1_6_1/DateStrings.cpp: In function 'char monthStr(uint8_t)': /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/tools/sdk/libc/xtensa-lx106-elf/include/sys/pgmspace.h:76:81: error: 'const void' is not a pointer-to-object type

define pgm_read_ptr(addr) (reinterpret_cast<const void>(addr))

^ /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/tools/sdk/libc/xtensa-lx106-elf/include/sys/string.h:32:57: note: in definition of macro 'strcpy_P'

define strcpy_P(dest, src) strncpy_P((dest), (src), SIZE_IRRELEVANT)

^ /home/builder/opt/libraries/latest/time_1_6_1/DateStrings.cpp:72:29: note: in expansion of macro 'pgm_read_ptr' strcpy_P(buffer, (PGM_P)pgm_read_ptr(&(monthNames_P[month]))); ^ /home/builder/opt/libraries/latest/time_1_6_1/DateStrings.cpp: In function 'char dayStr(uint8_t)': /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/tools/sdk/libc/xtensa-lx106-elf/include/sys/pgmspace.h:76:81: error: 'const void' is not a pointer-to-object type

define pgm_read_ptr(addr) (reinterpret_cast<const void>(addr))

^ /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/tools/sdk/libc/xtensa-lx106-elf/include/sys/string.h:32:57: note: in definition of macro 'strcpy_P'

define strcpy_P(dest, src) strncpy_P((dest), (src), SIZE_IRRELEVANT)

^ /home/builder/opt/libraries/latest/time_1_6_1/DateStrings.cpp:86:28: note: in expansion of macro 'pgm_read_ptr' strcpy_P(buffer, (PGM_P)pgm_read_ptr(&(dayNames_P[day]))); ^ Error during build: exit status 1

Steps To Reproduce Problem

Copy the sample code from Time/examples/TimeSerial/TimeSerial.ino to the Arduino Web IDE https://create.arduino.cc/editor. Try to compile is for NodeMCU1.0 (ESP_12-E Module)

Hardware & Software

Board ESP8266 NodeMCU V3 Shields / modules used: Arduino IDE version: Arduino Web IDE https://create.arduino.cc/editor Teensyduino version (if using Teensy) Version info & package name (from Tools > Boards > Board Manager) NodeMCU1.0 (ESP_12-E Module) Operating system & version Windows 10 Any other software or hardware?

Arduino Sketch

Time/examples/TimeSerial/TimeSerial.ino

Errors or Incorrect Output

/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/tools/sdk/libc/xtensa-lx106-elf/include/sys/pgmspace.h:76:81: error: 'const void*' is not a pointer-to-object type

define pgm_read_ptr(addr) (reinterpret_cast<const void>(addr))

^

SurenBono commented 1 year ago

Try copy pasting the src into the project folder and #include with "timelib.h"...it's been three years since my first problem with compiling it..