Esp8266 SSL compile error

I’m doing some experiments with Blynk and an ESP8266_01 board, I have compiled ESP8266_Standalone example without errors, but if I try to compile ESP8266_Standalone_SSL, compilation ends with a series of errors. Same examples compile without errors on Arduino IDE.

This is my configuration:

Espressif 8266 v1.7.3
Blynk v0.5.3 
Time v1.5


platform = espressif8266
board = esp01_1m
framework = arduino

This is the error, I can not figure out where the problem is.

xtensa-lx106-elf-g++ -o .pioenvs\esp01_1m\src\main.cpp.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -Wall -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30600 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP01 -DARDUINO=10805 -DARDUINO_BOARD=\"PLATFORMIO_ESP01_1M\" -DLWIP_OPEN_SRC -U__STRICT_ANSI__ -Isrc -I.piolibdeps\Time_ID44 -IC:\Users\paolo\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src -I.piolibdeps\Blynk_ID415\src -IC:\Users\paolo\.platformio\packages\framework-arduinoespressif8266\tools\sdk\include -IC:\Users\paolo\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include -IC:\Users\paolo\.platformio\packages\framework-arduinoespressif8266\cores\esp8266 -IC:\Users\paolo\.platformio\packages\framework-arduinoespressif8266\tools\sdk\lwip\include -IC:\Users\paolo\.platformio\packages\framework-arduinoespressif8266\variants\generic src\main.cpp

In file included from src\main.cpp:37:0:
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h: In member function 'bool BlynkArduinoClientSecure<Client>::connect()':
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:70:34: error: there are no arguments to 'time' that depend on a template parameter, so a declaration of 'time' must be available [-fpermissive]
time_t now = time(nullptr);
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:70:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:73:29: error: there are no arguments to 'time' that depend on a template parameter, so a declaration of 'time' must be available [-fpermissive]
now = time(nullptr);
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:76:33: error: there are no arguments to 'gmtime_r' that depend on a template parameter, so a declaration of 'gmtime_r' must be available [-fpermissive]
gmtime_r(&now, &timeinfo);
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:77:43: error: there are no arguments to 'asctime' that depend on a template parameter, so a declaration of 'asctime' must be available [-fpermissive]
String ntpTime = asctime(&timeinfo);
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h: In instantiation of 'bool BlynkArduinoClientSecure<Client>::connect() [with Client = WiFiClientSecure]':
.piolibdeps\Blynk_ID415\src/Blynk/BlynkProtocol.h:203:17:   required from 'bool BlynkProtocol<Transp>::run(bool) [with Transp = BlynkArduinoClientSecure<WiFiClientSecure>]'
src\main.cpp:58:13:   required from here
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:70:34: error: 'time' was not declared in this scope
time_t now = time(nullptr);
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:73:29: error: 'time' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
now = time(nullptr);
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:70:34: note: 'time' declared here, later in the translation unit
time_t now = time(nullptr);
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:75:19: error: 'tm timeinfo' has incomplete type
struct tm timeinfo;
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:76:33: error: 'gmtime_r' was not declared in this scope
gmtime_r(&now, &timeinfo);
.piolibdeps\Blynk_ID415\src/BlynkSimpleEsp8266_SSL.h:77:43: error: 'asctime' was not declared in this scope
String ntpTime = asctime(&timeinfo);
*** [.pioenvs\esp01_1m\src\main.cpp.o] Error 1

@vshymanskyy do you have any ideas?

I might say for the sake of completeness that I first open this topic on Blynk support forum, @vshymanskyy was the one who advised me to try Arduino IDE to check if the library was working on other IDE, and since it works I thought it was a PlatformIO issue.

See Travis CI - Test and Deploy Your Code with Confidence

It seems that you installed some conflicted Time library in global storage. Please navigate to PlatformIO IDE > PIO Home > Libraries > Instaled and remove it.

Also, if you need this custom lib, use TimeLib.h instead. See fix name conflict with Arduino/Time.h by dpeddi · Pull Request #67 · PaulStoffregen/Time · GitHub

Removing Time library allow to compile ESP8266_Standalone_SSL example, so I have done other tests, in my project I’m using WidgetRTC from blynk library, this component require TimeLib.h, compiling the RTC.ino example result in success using this library but RTC example use BlynkSimpleEthernet not BlynkSimpleEsp8266_SSL. If you change the example to use BlynkSimpleEsp8266_SSL with exact the same library the error reappear.

RTC example compile success with this includes:

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <TimeLib.h>
#include <WidgetRTC.h>

RTC example give the previous error with this include

#include <SPI.h>
// #include <Ethernet.h>
// #include <BlynkSimpleEthernet.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266_SSL.h>
#include <TimeLib.h>
#include <WidgetRTC.h>

I’m doing something wrong?

As the last test I compiled the example RTC.ino modified with wifi includes on Arduino IDE and the compilation ends successfully. The same code does not seem to compile on platformIO.

This is the code I used to test the issue, the same TimeLib 1.5 was used on both IDE.

  Download latest Blynk library here:

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials:
    Sketch generator: 
    Blynk community:  
    Follow us:        

  Blynk library is licensed under MIT license
  This example code is in public domain.


  Blynk can provide your device with time data, like an RTC.
  Please note that the accuracy of this method is up to several seconds.

  App project setup:
    RTC widget (no pin required)
    Value Display widget on V1
    Value Display widget on V2

  For this example you'll need Time keeping library:

  This code is based on an example from the Time library:

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <SPI.h>
//#include <Ethernet.h>
//#include <BlynkSimpleEthernet.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266_SSL.h>
#include <TimeLib.h>
#include <WidgetRTC.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

BlynkTimer timer;

WidgetRTC rtc;

// Digital clock display of the time
void clockDisplay()
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute() + ":" + second();
  String currentDate = String(day()) + " " + month() + " " + year();
  Serial.print("Current time: ");
  Serial.print(" ");

  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);

  // Synchronize time on connection

void setup()
  // Debug console


  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  // Read more:

  setSyncInterval(10 * 60); // Sync interval in seconds (10 minutes)

  // Display digital clock every 10 seconds
  timer.setInterval(10000L, clockDisplay);

void loop()

Could you try this solution?

As a workaround, could you please try to rename Time.h to _Time.h in Time library and build your project again?

Yes, renaming all occurrence of Time.h with _Time.h I’m able to compile RTC example with SSL, I can use this workaround for my project but we need a more stable solution, I see you have closed issue #909, but seems to me that the issue still exists.