MKRGSM
MKRGSM copied to clipboard
Error while compiling with getTime() in GSM.cpp
I get following error messages while compiling my project:
`Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino MKR GSM 1400"
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp: In member function 'long unsigned int GSM::getTime()':
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:339:13: error: aggregate 'GSM::getTime()::tm now' has incomplete type and cannot be defined
struct tm now;
^~~
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:341:7: error: 'strptime' was not declared in this scope
if (strptime(response.c_str(), "+CCLK: "%y/%m/%d,%H:%M:%S", &now) != NULL) {
^~~~~~~~
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:341:7: note: suggested alternative: 'strxfrm'
if (strptime(response.c_str(), "+CCLK: "%y/%m/%d,%H:%M:%S", &now) != NULL) {
^~~~~~~~
strxfrm
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:344:21: error: 'mktime' was not declared in this scope
time_t result = mktime(&now);
^~~~~~
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:344:21: note: suggested alternative: 'getTime'
time_t result = mktime(&now);
^~~~~~
getTime
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp: In member function 'long unsigned int GSM::getLocalTime()':
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:368:13: error: aggregate 'GSM::getLocalTime()::tm now' has incomplete type and cannot be defined
struct tm now;
^~~
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:370:7: error: 'strptime' was not declared in this scope
if (strptime(response.c_str(), "+CCLK: "%y/%m/%d,%H:%M:%S", &now) != NULL) {
^~~~~~~~
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:370:7: note: suggested alternative: 'strxfrm'
if (strptime(response.c_str(), "+CCLK: "%y/%m/%d,%H:%M:%S", &now) != NULL) {
^~~~~~~~
strxfrm
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:371:21: error: 'mktime' was not declared in this scope
time_t result = mktime(&now);
^~~~~~
D:\OneDrive\Arduino\libraries\MKRGSM\src\GSM.cpp:371:21: note: suggested alternative: 'getTime'
time_t result = mktime(&now);
^~~~~~
getTime
exit status 1`
im gettign the same error when i restart the ide if i have #include <TimeLib.h> inside the code. if i comment it out, recompile, uncomment it, and recompile again it will work. but i have to do this everytime i close the ide. and if i use any code that uses the timelib library i need to comment that out to so i get the first successful compile