arduino-libraries / MKRGSM

GNU Lesser General Public License v2.1
54 stars 51 forks source link

Error while compiling with getTime() in GSM.cpp #120

Open diddi68 opened 4 years ago

diddi68 commented 4 years ago

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`

sparten9999 commented 3 years ago

im gettign the same error when i restart the ide if i have #include 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