0

Dusk2Dawn.h won't compile on Trinket M0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Dusk2Dawn.h won't compile on Trinket M0

by augendoc on Fri Sep 13, 2019 1:23 pm

My sketch uses a DS3231, a 16x2 LCD and small solid state relay to turn a small light on and off based on sunrise and sunset. I'm using wire.h, LCD.h, RTClib.h, LiquidCrystal_I2C.h and Dusk2Dawn.h. The latter is used to calculate sunrise and sunset times. The sketch runs just fine on a Feather M0. On the Trinket M0 Dusk2Dawn will not compile. When I comment out everything having to do with this library, the rest of the sketch compiles, loads and runs just fine on the Trinket M0. I get these two errors:

error: cannot declare member function 'static bool Dusk2Dawn::min2str(char*, int)' to have static linkage [-fpermissive]

error: cannot declare member function 'static bool Dusk2Dawn::zeroPadTime(char*, byte)' to have static linkage [-fpermissive]

Anyone have any idea what this means and how I can fix it?

augendoc
 
Posts: 5
Joined: Mon Dec 08, 2014 4:47 am

Re: Dusk2Dawn.h won't compile on Trinket M0

by adafruit_support_mike on Sun Sep 15, 2019 4:00 am

'Static member functions' are functions associated with a class, and not with any specific instance of that class. They're generally used to set or read behind-the-scenes 'static variables' that control the way objects behave.. configuring all objects in a 'String' class to switch between UTF-8 and ASCII, for instance.

The error above means the code used the 'static' keyword where it shouldn't. Post the contents of your Dusk2Dawn.h and Dusk2Dawn.cpp files between CODE tags please.

adafruit_support_mike
 
Posts: 58798
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.