Skip to content
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

strerror throwing error in compiler VS2015 #403

Closed
Naomi-Dennis opened this issue Dec 23, 2016 · 1 comment
Closed

strerror throwing error in compiler VS2015 #403

Naomi-Dennis opened this issue Dec 23, 2016 · 1 comment
Assignees
Labels

Comments

@Naomi-Dennis
Copy link

strerror is deprecated and VS won't compile with it.

I'm using an ifstream, that's when the error it thrown.

The exact error is below:
'strerror': 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. Creation_Kit c:\...\json.hpp 8998

@nlohmann nlohmann added the platform: visual studio related to MSVC label Dec 23, 2016
@nlohmann
Copy link
Owner

nlohmann commented Dec 25, 2016

I understand the issue. We currently use strerror in one situation:

// immediately abort if stream is erroneous
if (s.fail())
{
    throw std::invalid_argument("stream error: " +  std::string(strerror(errno)));
}

As strerror_s seems not to be portable, we cannot easily get rid of the call. Maybe dropping the descriptive string in the exception could be the solution here.

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

No branches or pull requests

2 participants