Skip to content

-Wdeprecated-declarations Warning #377

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

Open
1 task done
ambiennt opened this issue Apr 6, 2025 · 1 comment
Open
1 task done

-Wdeprecated-declarations Warning #377

ambiennt opened this issue Apr 6, 2025 · 1 comment

Comments

@ambiennt
Copy link
Contributor

ambiennt commented Apr 6, 2025

What happened?

Using:
nlohmann/json@11aa5f9
e71e0c2
openssl/openssl@648366a

Compiling with Clang-cl 20.1.1, and passing /W4 /DJWT_DISABLE_PICOJSON /std:c++latest

How To Reproduce?

#include <jwt-cpp/jwt.h>
#include <jwt-cpp/traits/nlohmann-json/defaults.h>

int main() {
    // *jwt.h(3530,70): warning : 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    // *jwt.h(3546,27): warning : 'wcrtomb' is deprecated: This function or variable may be unsafe. Consider using wcrtomb_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
    jwt::create();
}

Version

0.7.1

What OS are you seeing the problem on?

Windows

What compiler are you seeing the problem on?

Clang

Relevant log output

*jwt.h(3530,70): warning : 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
*jwt.h(3546,27): warning : 'wcrtomb' is deprecated: This function or variable may be unsafe. Consider using wcrtomb_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]

Code of Conduct

  • I agree to follow this project's Code of Conduct
@prince-chrismc
Copy link
Collaborator

prince-chrismc commented Apr 7, 2025

https://en.cppreference.com/w/c/string/byte/strerror

As with all bounds-checked functions, strerror_s and strerrorlen_s are only guaranteed to be available if STDC_LIB_EXT1 is defined by the implementation and if the user defines STDC_WANT_LIB_EXT1 to the integer constant 1 before including <string.h>

These are not generally available and are an optional feature that's on my default for windows https://en.m.wikipedia.org/wiki/C11_(C_standard_revision) so there's a lack of compatibility to use them.

You can control this in your own project with https://stackoverflow.com/a/617586/8480874 for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants