-
Notifications
You must be signed in to change notification settings - Fork 616
MSVC12 Compatibility #2
Comments
Hm, apparently VS2013 is supposed to support declval. But, it looks like I forgot to include in json11.hpp. It could be that declval is accidentally available on gcc/clang because of the other includes, but not in MSVC. Does adding that #include fix it? json11 only uses snprintf to print numbers, so it should be "safe" to replace all instances of snprintf with sprintf... I'd want to triple-check all the buffer sizes, though. |
I forgot to mention that I already added <type_traits> to check if this is the issue. |
Just wanted to tell you that I created a copy for me that is header only and compatible with gcc and msvc12 although I currently excluded the two templates that won't compile with msvc12. It's currently very rough and looks like patchwork but it works for now. |
I was able to get it to compile by adding this right above
Intellisense still doesn't like the |
@retrop we can mimic see:
note:
|
I really like the library design and would like to use it cross platform. Unfortunately there are a few roadblocks for using it with MSVC12 (VS2013):
The first one can be easily fixed by removing the initializers and adding them to the initializer-list in statics():
The missing noexcept and sprintf are a bit harder. MSVC12 does not (yet) include them. It is possible to create a preprocessor define for noexcept after the STL header includes (as an error is thrown when trying to define the missing noexcept myself). snprintf can be replaced by _snprintf but unfortunately behaves a bit different (snprintf truncates and always 0-terminates, _snprintf does not 0-terminate if the buffer is too small, also the return values are different which are not used anyway).
I didn't invest enough much time digging in c++11s templating features to understand the third problem yet. A simple solution is to comment out the two constructors but I am sure there is a better solution.
This is an issue for me and I don't know if you are interested in supporting MSVC12 (don't know if this gets better with the next compiler update).
PS: Having this library header only would be really nice too, but that's secondary for now
The text was updated successfully, but these errors were encountered: