-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
error C2039: '_snprintf': is not a member of 'std' - Windows #1408
Comments
This is strange, because the MSVC builds run without problems on AppVeyor, see https://ci.appveyor.com/project/nlohmann/json. |
|
Might it be the version: Utility Version 14.16.27023.1 |
It seems that Microsoft somewhere uses a macro and forwards |
Json CPP had similar problem. open-source-parsers/jsoncpp#224 Maybe you just need to add:
To support version earlier than 15 |
Sigh... Yet another instance where I need to "patch" C++11 code such that it can compile with the most recent Microsoft compiler... |
Unfortunately that’s not uncommon. |
Are you sure this definition is from VC++ itself and not some other library that you're including? |
I’m not sure at all. While developing I build the addon on Mac which doesn’t have the issue. The windows build happens on the automated build system for the addon. |
I also had this problem, but the query found that other libraries defined it. I am also very upset now. |
This is tricky, my guess is the occurrences of this will rise with adoption and it will be difficult to define to users what the correct workaround is. |
@1996sc30 You are saying that the define came from another library, but not this one? Meaning the error has nothing to do with this library? |
Yes!Indeed so. |
@phunkyfish Can you confirm @1996sc30 's observation? |
Let me find who to ask and I will bring them in on this thread. Should the code be compatible with utility version 14.16.27023.1? @1996sc30 can you confirm what compiler and utility version you are using? Also which was the offending library that caused this problem? |
@phunkyfish I do not understand the question. |
I am using VS2015 and using nlohmann/json as the latest version, the conflict is the other library(evpp—https://github.com/Qihoo360/evpp) I used in the project . |
So it seems we can close this issue? |
Yes, thanks! |
I experienced this issue with Visual Studio 2015. My application used Python as embedded scripting language, and So, when you have such issue, first of all you have to review other open source dependencies that you have in your project. |
Yes, the solution in my case was to undef in my app to allow the standard declaration to work. |
This seems to be an issue with Microsoft declaring a snprintf macro which causes issues. Related issues: - nlohmann/json#1408 - kodi-pvr/pvr.vuplus#162
This seems to be an issue with Microsoft declaring a snprintf macro which causes issues. Related issues: - nlohmann/json#1408 - kodi-pvr/pvr.vuplus#162
This seems to be an issue with Microsoft declaring a snprintf macro which causes issues. Related issues: - nlohmann/json#1408 - kodi-pvr/pvr.vuplus#162
This seems to be an issue with Microsoft declaring a snprintf macro which causes issues. Related issues: - nlohmann/json#1408 - kodi-pvr/pvr.vuplus#162
This seems to be an issue with Microsoft declaring a snprintf macro which causes issues. Related issues: - nlohmann/json#1408 - kodi-pvr/pvr.vuplus#162
I'm not sure why this is closed as out of scope. Any program that includes |
I don't think so. This would be as surprising for users of the library as other libraries introducing such macros in the first place. |
Fair point. :-) |
you can add “#undef snprintf” At the head of the file json.hpp |
No, it’s not the library‘s job to clean up such names. |
Agreed that users of C++ libraries that |
This works fine on MSVC. In my case the offender was the Autodesk FBX SDK. |
Is there any chance in the future of just using |
I used the latest release (single include file), compiled using VS2017 - Visual Studio 2017 Developer Command Prompt v15.9.1.
As a work around I removed
std::
from all thesnprintf
calls.I was building an addon for kodi: kodi-pvr/pvr.vuplus#156
Full gist of build output: https://gist.github.com/phunkyfish/c8456619bd85c16b1f9243e83517ac46
Note that it builds for all other platforms without issue.
The text was updated successfully, but these errors were encountered: