Error when include WidgetRTC.h

On my sketch I’m using the following library:

#include <SimpleTimer.h>
#include <Time.h>
#include <TimeLib.h>
#include <SunLight.h>
#include "RTClib.h"

with no problem, if I also include the:
#include <WidgetRTC.h>

I get the followings errors:

In file included from C:\Users\Igor\Documents\Arduino\myReef2_Mega\myReef2_Mega.ino:17:0:

C:\Users\Igor\Documents\Arduino\libraries\Blynk/WidgetRTC.h: In function 'time_t WidgetRTC_impl::requestTimeSync()':

C:\Users\Igor\Documents\Arduino\libraries\Blynk/WidgetRTC.h:36:5: error: 'Blynk' was not declared in this scope

     Blynk.syncVirtual(WidgetRTC::mPin); // Request RTC widget update from the server

Some ideas?

@naamah75 do you have the Blynk libraries in your sketch?

Have to tried with just one Time library and what is the difference between one and the other?

I’m using ESP8266_Lib.h and BlynkSimpleShieldEsp8266.h as Blynk libraries (that’s obiously I’ve included on my sketch).
Using only WidgetRTC.h and Time.h the problem doesn’t change.

Can you post the complete sketch? It’s a little hard to see what’s going wrong with limited information :slight_smile:

1 Like

I’m guessing it is because you have too many time libraries and they are conflicting.

@Lichtsignaal, my sketch is over 2500 lines… I think it’s impossible to post here.
@Costas, okay, but I’ve tried with only WidgetRTC.h and Time.h and the problem persist.

Where are you getting Time.h from as there are several versions?

That is a big one indeed. Have you tried the simple examples? I always go from there and integrate them into my own sketches via copy/paste. That way I’m pretty sure it’ll work like I want it too.

That is the wrong library. As per RTC example you need #include <TimeLib.h>

Try all widget test sketches before integrating into your own sketches.

I’m talking about this Time.h library

You don’t want to be using that unless you are running a very old version of the IDE, see my last post for the correct library.

1 Like

Ok, maybe this it’s the problem, but to verify I need to rewrite all my code using the Time.h … I need much time to do.
Anyway thanks for your suggest! :ok_hand:

The time libraries are all VERY similar so yu shouldn’t have to rewrite much, or any, code.