Aggregate 'tm timeinfo' has incomplete type and cannot be defined

I am currently working on a project and i wanna display the curent time on an LCD. To achieve that i am taking part of Rui Santos code from this project: https://RandomNerdTutorials.com/esp32-date-time-ntp-client-server-arduino/

I get an error at this part of the code:

void printLocalTime(){
  struct tm timeinfo;
  if(!getLocalTime(&timeinfo)){
    Serial.println("Failed to obtain time");
    return;
  }
}

And the error message i get above the timeinfo is : aggregate 'tm timeinfo' has incomplete type and cannot be defined

I saw on some thread that it might be the library that i’m using but since i dont download them and just use this:

lib_deps = 
    WiFi
    ESP Async WebServer
    Adafruit Unified Sensor
    DHT sensor library
    LiquidCrystal_I2C
    NTPClient
    Wire
    Time

in the platformio.ini, i dont understand how i could modify its name? Or maybe I’m not using the right library? i tried #include <time.h>, #include <Time.h>, #include <TimeLib.h> and none of them are working.

Ah yes, the infamous Time library which names its Time.h header exactly as the C standard library’s time.h header, and Windows has a case-insensitive file system :slight_smile:

Can you remove Time from lib_deps and add it to lib_ignore if necessary?

1 Like

Ahah as i can see it looks like its been a long lasting problem !! Thank you it fixed my problem !!

Max,
It is so great that this forum exists with all of your knowledge. This posting quickly fixed a problem for me as well.
Thanks,
Pete