Skip to content

'strptime' was not declared in this scope #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ndx1905-github opened this issue May 22, 2021 · 5 comments
Closed

'strptime' was not declared in this scope #1567

ndx1905-github opened this issue May 22, 2021 · 5 comments
Labels

Comments

@ndx1905-github
Copy link

I was using the strptime function as described here https://arduinojson.org/news/2021/05/04/version-6-18-0/

for some reason, it worked a couple days ago, and now when I try to compile my code, I have an error
'strpftime' was not declared in this scope; did you mean 'strftime'?

I tried to look in the arduinojson 6.18.0 src and found references to strftime, but not to strpftime

I don't know what happened code was working 10 days ago, and now I'm lost

Feature published in ArduinoJson 6.18.0

Originally posted by @bblanchon in #687 (comment)

@bblanchon bblanchon changed the title strptime not working anymore Feature published in [ArduinoJson 6.18.0](https://arduinojson.org/news/2021/05/04/version-6-18-0/) 'strpftime' was not declared in this scope May 23, 2021
@bblanchon
Copy link
Owner

bblanchon commented May 23, 2021

Hi @ndx1905-github,

strptime() is a non-standard function, usually provided by the time.h header; make sure you include this header.

Did you recently switch to different hardware? Maybe the function is not available on the corresponding core.

Best regards,
Benoit

PS: in your message, you wrote strpftime instead of strptime; I'm assuming it's a typo.

@bblanchon bblanchon changed the title 'strpftime' was not declared in this scope 'strptime' was not declared in this scope May 23, 2021
@ndx1905-github
Copy link
Author

Bonjour Benoit

thanks for the answer.
time.h is indeed included. I've noticed I was using Time.h (capital letter) instead of time.h, but changing that didn't havee any effect. Also as I said, code was working, and it stopped working without me consciouly changing anything.

but you are right! i've changed hardware. I was compiling for a generic ESP8266 module and tried to compile code for a variant of ESP8266, namely a D1 mini.

That was the first time I got an error.

However I switched back to the former setting and hardware, and it doesn't compile anymore for the old hardware which I don't understand at all.

I've also updated the ESP8266 board libraries from 2.7x to 3.0, so maybe that's the problem. I'll try to revert and see if it works

PS: yes strpftime was a typo in this message only and not in the code, sorry

@ndx1905-github
Copy link
Author

That was it..!

code and strptime() compiles fine with version 2.7.4 of ESP8266 board manager https://github.com/esp8266/Arduino

but breaks with version 3.0 that was recently released, for all cards

I've reverted to 2.7.4 and it works fine, but it's annoying not to know why it's not working for 3.0

@bblanchon
Copy link
Owner

bblanchon commented May 24, 2021

I think that's a question for the ESP8266 core team.
I saw they switched to newlib, which should support strptime() as well.

@bblanchon
Copy link
Owner

@ndx1905-github, any update?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants