• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32 compile error, NTPClient, “ESP32 Data Logging Temperature to MicroSD Card”

Q&A Forum › Category: Arduino › ESP32 compile error, NTPClient, “ESP32 Data Logging Temperature to MicroSD Card”
0 Vote Up Vote Down
kaktus asked 1 year ago

Hi.
I found some free time to practice the project “ESP32 Data Logging Temperature to MicroSD Card“

Unfortunately, the compilation does not run correctly and is aborted due to an error.

Linking everything together...
/home/kaktus/.arduino15/packages/esp32/tools/esp-x32/2302/bin/xtensa-esp32-elf-g++ @/home/kaktus/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-442a798083/esp32/flags/ld_flags @/home/kaktus/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-442a798083/esp32/flags/ld_scripts -Wl,--Map=/tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/ESP32-CAM_DS18B20_NTP_SD.ino.map -L/home/kaktus/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-442a798083/esp32/lib -L/home/kaktus/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-442a798083/esp32/ld -L/home/kaktus/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-442a798083/esp32/qio_qspi -Wl,--wrap=esp_panic_handler -Wl,--start-group /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/sketch/ESP32-CAM_DS18B20_NTP_SD.ino.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/FS/FS.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/FS/vfs_api.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/SD_MMC/SD_MMC.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/OneWire/OneWire.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/DallasTemperature/DallasTemperature.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/WiFi/AP.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/WiFi/STA.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/WiFi/WiFi.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/WiFi/WiFiAP.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/WiFi/WiFiGeneric.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/WiFi/WiFiMulti.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/WiFi/WiFiSTA.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/WiFi/WiFiScan.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/Network/NetworkClient.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/Network/NetworkEvents.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/Network/NetworkInterface.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/Network/NetworkManager.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/Network/NetworkServer.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/Network/NetworkUdp.cpp.o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/libraries/NTPClient/NTPClient.cpp.o /tmp/arduino/cores/21d3a2a0cb06a188872953b033180085/core.a @/home/kaktus/.arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-442a798083/esp32/flags/ld_libs -Wl,--end-group -Wl,-EL -o /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/ESP32-CAM_DS18B20_NTP_SD.ino.elf
/home/kaktus/.arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld: /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/sketch/ESP32-CAM_DS18B20_NTP_SD.ino.cpp.o:(.literal._Z12getTimeStampv+0x24): undefined reference to `_ZN9NTPClient16getFormattedDateEm'
/home/kaktus/.arduino15/packages/esp32/tools/esp-x32/2302/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld: /tmp/arduino/sketches/EC1C588FEA89B9F4B671207E9CB058BD/sketch/ESP32-CAM_DS18B20_NTP_SD.ino.cpp.o: in function `_Z12getTimeStampv':
/home/kaktus/Projekty/ESP/ESP32-CAM_DS18B20_NTP_SD/ESP32-CAM_DS18B20_NTP_SD.ino:169: undefined reference to `_ZN9NTPClient16getFormattedDateEm'
collect2: error: ld returned 1 exit status

Arduino IDE 2.3.2
board: AI Thinker ESP32-CAM
NTPClient library in the version from the link in the presentation.
If I update this library to the latest one I get rid of the getFormattedDate() function
However, after modifying the code to work without it, I can run the module and everything works.
Since I am still a beginner I will ask for suggestions on what to do to solve my problem.

When I use the definition:

NTPClient timeClient(ntpUDP, "vega.cbk.poznan.pl", 7200, 60000);

I get even more error errors that I am also unable to handle on my own.

Question Tags: NTPClient; compile error
8 Answers
1 Vote Up Vote Down
Best Answer
Sara Santos Staff answered 1 year ago

Hi.
Please install the NTP Client as per the instructions:
NTPClient library

  1. Click here to download the NTPClient library. You should have a .zip folder in your Downloads
  2. In the Arduino IDE, go to Skethc > Include Library > Add .ZIP library
  3. Select the .ZIP file you downloaded 
  4. Finally, re-open your Arduino IDE

This is a different library than the one in the Arduino Library Manager.
 
Regards,
Sara

0 Vote Up Vote Down
kaktus answered 1 year ago

Hey Sara.
I am aware of the dissimilarity of this library. As I wrote in the introduction the error I get when I use just this version.

cpp.o:(.literal._Z12getTimeStampv+0x24): undefined reference to `_ZN9NTPClient16getFormattedDateEm'
cpp.o: in function `_Z12getTimeStampv':
169: undefined reference to `_ZN9NTPClient16getFormattedDateEm'

above log snippet
line 169 looks like this to me:

formattedDate = timeClient.getFormattedDate();

I think the message is specific and an advanced dev can give me a good hint.

0 Vote Up Vote Down
kaktus answered 1 year ago

All in all, I focused again on your answer.
Point #2 was key.

I had previously unpacked the library on my own. And that was causing the error.
Now the program processed everything on its own and, as you can see, registered the missing function definition.
I achieved success.
Thank you

0 Vote Up Vote Down
kaktus answered 1 year ago

I have yet related to this forum.
How to properly attach some tags when creating a post? I used a semicolon but I have doubts that it worked properly.
What should I do to make my problem have a label resolved?

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
Thanks for your feedback.
I need to update the instructions to install the library on that project.
It was for an older version of the Arduino IDE.
Thanks for your patience.
Regards,
Sara

0 Vote Up Vote Down
kaktus answered 1 year ago

You are a professional and I enjoy talking to you.

I was able to make some slight modifications in this project:
different CF card support
I also added the date to the file name so that each day a new file with measurements is created.
This sample code can be a nice template for larger projects.
I also have some ideas that I may be able to implement.
I have to read a lot …

I will also want to make this program immune to the lack of network access, and the lack of a CF card.
At the moment, these events prevent the entire electronic system from working properly.

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
I already updated the instructions to install the libraries in that article.
To work without network access, you can use an external RTC module, or use a GPS module to get the time:

  • https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/ (this is for the Arduino board, but for the ESP32, it should be similar)
  • https://randomnerdtutorials.com/guide-to-neo-6m-gps-module-with-arduino/ (this is also for the arduino, but similar for an ESP32)

To save data without microSD card, you can save files to the LittleFS filesystem.

  • https://randomnerdtutorials.com/esp32-write-data-littlefs-arduino/

Of course, there are many different ways to achieve the same results, and possibly better options. But, these are the tutorials we have at the moment.
 
Regards,
Sara
 

0 Vote Up Vote Down
kaktus answered 1 year ago

I have not yet become thoroughly familiar with the ESP32 hardware, but I am surprised that such a powerful MCU does not have a built-in RTC and you have to add more blocks.
I haven’t gotten to know the ESP32 hardware yet, but I’m surprised that such a powerful MCU doesn’t have a built-in RTC and you have to add more blocks.
I really like the LittleFS file system suggestion. This is an interesting alternative. However, my main intention will be to handle missing SD card errors in the code.

Earlier, I forgot to add that I would also like to implement recognition of whether summer or winter time applies. And using the appropriate offset.
In the meantime, I have to go through: https://www.arduino.cc/reference/en/
 
😉

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.