RTC Library: tm epoch_tm' has incomplete type and cannot be defined

Hello

I am desperate since I cannot compile the code below since days. Before it worked. I guess it came since I updated libraries.

I found, that this error only appears when I use the DCF77 and RTC library together. I think there is some conflict. You can find the code attached. The error message you can read below:

C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS1307.cpp: In member function 'void DS1307::setEpoch(time_t)':
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS1307.cpp:424:12: error: aggregate 'DS1307::setEpoch(time_t)::tm epoch_tm' has incomplete type and cannot be defined
  struct tm epoch_tm, * ptr_epoch_tm;
            ^~~~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS1307.cpp:427:17: error: 'gmtime' was not declared in this scope
  ptr_epoch_tm = gmtime(&rawtime);
                 ^~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\PCF8563.cpp: In member function 'void PCF8563::setEpoch(time_t)':
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\PCF8563.cpp:313:15: error: aggregate 'PCF8563::setEpoch(time_t)::tm epoch_tm' has incomplete type and cannot be defined
     struct tm epoch_tm , *ptr_epoch_tm;
               ^~~~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\PCF8563.cpp:317:20: error: 'gmtime' was not declared in this scope
     ptr_epoch_tm = gmtime(&rawtime);
                    ^~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS3231.cpp: In member function 'void DS3231::setEpoch(time_t, time_t, int16_t)':
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS3231.cpp:526:12: error: aggregate 'DS3231::setEpoch(time_t, time_t, int16_t)::tm epoch_tm' has incomplete type and cannot be defined
  struct tm epoch_tm, * ptr_epoch_tm;
            ^~~~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS3231.cpp:531:17: error: 'gmtime' was not declared in this scope
  ptr_epoch_tm = gmtime(&rawtime);
                 ^~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS3231.cpp:531:17: note: suggested alternative: 'setTime'
  ptr_epoch_tm = gmtime(&rawtime);
                 ^~~~~~
                 setTime
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS3231.cpp: In member function 'time_t DS3231::getEpoch()':
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS3231.cpp:551:12: error: aggregate 'DS3231::getEpoch()::tm epoch_tm' has incomplete type and cannot be defined
  struct tm epoch_tm;
            ^~~~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS3231.cpp:561:10: error: 'mktime' was not declared in this scope
  epoch = mktime(&epoch_tm);
          ^~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS1307.cpp:427:17: note: suggested alternative: 'setTime'
  ptr_epoch_tm = gmtime(&rawtime);
                 ^~~~~~
                 setTime
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\PCF8563.cpp:317:20: note: suggested alternative: 'setTime'
     ptr_epoch_tm = gmtime(&rawtime);
                    ^~~~~~
                    setTime
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS1307.cpp: In member function 'time_t DS1307::getEpoch()':
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS1307.cpp:445:12: error: aggregate 'DS1307::getEpoch()::tm epoch_tm' has incomplete type and cannot be defined
  struct tm epoch_tm;
            ^~~~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS1307.cpp:453:10: error: 'mktime' was not declared in this scope
  epoch = mktime(&epoch_tm);
          ^~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\PCF8563.cpp: In member function 'time_t PCF8563::getEpoch()':
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\PCF8563.cpp:337:15: error: aggregate 'PCF8563::getEpoch()::tm epoch_tm' has incomplete type and cannot be defined
     struct tm epoch_tm;
               ^~~~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\PCF8563.cpp:347:13: error: 'mktime' was not declared in this scope
     epoch = mktime (&epoch_tm);
             ^~~~~~
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS3231.cpp:561:10: note: suggested alternative: 'setTime'
  epoch = mktime(&epoch_tm);
          ^~~~~~
          setTime
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\PCF8563.cpp:347:13: note: suggested alternative: 'setTime'
     epoch = mktime (&epoch_tm);
             ^~~~~~
             setTime
C:\Users\urshe\Documents\Arduino\libraries\RTC\src\DS1307.cpp:453:10: note: suggested alternative: 'setTime'
  epoch = mktime(&epoch_tm);
          ^~~~~~
          setTime
exit status 1
Error compiling for board Arduino Nano.

Thank you for any hint to solve it.

BirdWatch.ino (13.9 KB)

Just out of curiosity, does swapping the include sequence of DCF77 and RTC libraries change the errors?
Have you tried using older versions of the libraries?

Replace your RTC library with the RTClib.h library. After doing so, it will require a little rework of your code since the RTClib returns a time which is of type DateTime and from that, you compute hours/minutes/seconds.

SteveMann:
Just out of curiosity, does swapping the include sequence of DCF77 and RTC libraries change the errors?
Have you tried using older versions of the libraries?

No, swapping the includes provided the same error. I tried before, to work with older versions of the libaries, but I was not able to compile it.

Please post the entire sketch, and links to the specific libraries that were included in that sketch.

blh64:
Replace your RTC library with the RTClib.h library. After doing so, it will require a little rework of your code since the RTClib returns a time which is of type DateTime and from that, you compute hours/minutes/seconds.

Thank you, I changed to RTClib library and rewrote the code. Now it works. Many thanks for the hint.