Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: TimeLib compilation-error ?

  1. #1
    Junior Member
    Join Date
    Jun 2019
    Posts
    3

    TimeLib compilation-error ?

    I've a huge project (Board Teensy 3.5 and Arduino IDE 1.8.8, Teensyduino 1.46) and since some days I'll get an error at compilationtime:

    Code:
    Test_Time:3: error: aggregate 'tm mytm' has incomplete type and cannot be defined
     struct tm mytm;
    I reduced the code to the minimum and the error ist still there:
    Code:
    #include <Time.h>        // https://github.com/PaulStoffregen/Time
    #include <TimeLib.h>   
    struct tm mytm;
    
    void setup(void) {}
    void loop(void) {}
    If I'll uncomment
    Code:
    // #include <TimeLib.h>
    the error is gone, but I need <TimeLib.h>

    Can anyone help me ?

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,251
    struct tm is NOT defined in "Time.h" (TD lib) but in <time.h> (system lib)
    Time.h is called from TimeLib.h
    unfortunately windows in case insensitive so struct tm is not reachable. solution: copy declaration of struct tm into your sketch.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,314
    Include only TimeLib.h. Do not include Time.h in your program. TimeLib.h is the one to include.

  4. #4
    Junior Member
    Join Date
    Jun 2019
    Posts
    3
    Hi WMXZ and Paul,

    many Thanks for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •