You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do not know. We use MSVC 19.0.24215.1 in the unit tests on AppVeyor (see https://ci.appveyor.com/project/nlohmann/json for the latest build result). Did you try? What error message did you get?
Just to share the error I got while compiling it with my VS build 14.023107.0
1>C:\Kratos\external_libraries\json/json.hpp(887): error C4579: 'nlohmann::detail::static_constnlohmann::detail::to_json_fn::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
1> with
1> [
1> T=nlohmann::detail::to_json_fn
1> ]
1> C:\Kratos\external_libraries\json/json.hpp(898): note: see reference to class template instantiation 'nlohmann::detail::static_constnlohmann::detail::to_json_fn' being compiled
1>C:\Kratos\external_libraries\json/json.hpp(887): error C2131: expression did not evaluate to a constant
1> C:\Kratos\external_libraries\json/json.hpp(887): note: failure was caused by returning the address of or a reference to a temporary
1>C:\Kratos\external_libraries\json/json.hpp(887): error C4579: 'nlohmann::detail::static_constnlohmann::detail::from_json_fn::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
1> with
1> [
1> T=nlohmann::detail::from_json_fn
1> ]
1> C:\Kratos\external_libraries\json/json.hpp(899): note: see reference to class template instantiation 'nlohmann::detail::static_constnlohmann::detail::from_json_fn' being compiled
1>C:\Kratos\external_libraries\json/json.hpp(6482): error C2784: '_Ty *std::begin(_Ty (&)[_Size]) noexcept': could not deduce template argument for '_Ty (&)[_Size]' from 'add_rvalue_reference::type'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xutility(1250): note: see declaration of 'std::begin'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(761): note: see reference to class template instantiation 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer' being compiled
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(790): note: see reference to class template instantiation 'std::is_nothrow_constructible<_Ty,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &&>' being compiled
1> with
1> [
1> _Ty=nlohmann::json
1> ]
1> C:\Kratos\external_libraries\json/json.hpp(12912): note: see reference to class template instantiation 'std::is_nothrow_move_constructiblenlohmann::json' being compiled
1>C:\Kratos\external_libraries\json/json.hpp(6482): error C2893: Failed to specialize function template 'unknown-type std::begin(const _Container &)'
1> C:\Kratos\external_libraries\json/json.hpp(6482): note: With the following template arguments:
1> C:\Kratos\external_libraries\json/json.hpp(6482): note: '_Container=add_rvalue_reference::type'
1>C:\Kratos\external_libraries\json/json.hpp(6482): error C2893: Failed to specialize function template 'unknown-type std::begin(_Container &)'
1> C:\Kratos\external_libraries\json/json.hpp(6482): note: With the following template arguments:
1> C:\Kratos\external_libraries\json/json.hpp(6482): note: '_Container=add_rvalue_reference::type'
1>C:\Kratos\external_libraries\json/json.hpp(6482): error C2784: 'const _Elem *std::begin(std::initializer_list<_Elem>) noexcept': could not deduce template argument for 'std::initializer_list<_Elem>' from 'add_rvalue_reference::type'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\initializer_list(60): note: see declaration of 'std::begin'
1>C:\Kratos\kratos\includes/kratos_parameters.h(174): error C2665: 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse': none of the 2 overloads could convert all the argument types
1> C:\Kratos\external_libraries\json/json.hpp(6361): note: could be 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &&,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\external_libraries\json/json.hpp(6352): note: or 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\kratos\includes/kratos_parameters.h(174): note: while trying to match the argument list '(const std::string)'
1>C:\Kratos\kratos\includes/kratos_parameters.h(183): error C2665: 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse': none of the 2 overloads could convert all the argument types
1> C:\Kratos\external_libraries\json/json.hpp(6361): note: could be 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &&,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\external_libraries\json/json.hpp(6352): note: or 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\kratos\includes/kratos_parameters.h(183): note: while trying to match the argument list '(const std::string)'
1>C:\Kratos\kratos\includes/kratos_parameters.h(188): error C2665: 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse': none of the 2 overloads could convert all the argument types
1> C:\Kratos\external_libraries\json/json.hpp(6361): note: could be 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &&,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\external_libraries\json/json.hpp(6352): note: or 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\kratos\includes/kratos_parameters.h(188): note: while trying to match the argument list '(const std::string)'
Could you please post the error from compiling the unit tests as well, because then we have the complete picture where the error first occurs.
Well, I am no expert in MSVC. It seems as if AppVeyor is using a slightly more modern version (just comparing the build version numbers). Is that Update 3?
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
2>------ Skipped Build: Project: RUN_TESTS, Configuration: Debug Win32 ------
2>Project not selected to build for this solution configuration
1> Checking Build System
1> CMake does not need to re-run because C:/Temp/json-develop/build/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because C:/Temp/json-develop/build/test/CMakeFiles/generate.stamp is up-to-date.
3>------ Build started: Project: catch_main, Configuration: Debug Win32 ------
4>------ Skipped Build: Project: clean_cotire, Configuration: Debug Win32 ------
4>Project not selected to build for this solution configuration
3> Building Custom Rule C:/Temp/json-develop/test/CMakeLists.txt
3> CMake does not need to re-run because C:\Temp\json-develop\build\test\CMakeFiles\generate.stamp is up-to-date.
3> unit.cpp
3> catch_main.vcxproj -> C:\Temp\json-develop\build\test\catch_main.dir\Debug\catch_main.lib
5>------ Build started: Project: json_unit, Configuration: Debug Win32 ------
5> Building Custom Rule C:/Temp/json-develop/test/CMakeLists.txt
5> CMake does not need to re-run because C:\Temp\json-develop\build\test\CMakeFiles\generate.stamp is up-to-date.
5> Generating CXX prefix header C:\Temp\json-develop\build\test\Debug\cotire\json_unit_CXX_prefix.hxx
5> unit-algorithms.cpp
5>C:\Temp\json-develop\src\json.hpp(887): error C4579: 'nlohmann::detail::static_const<nlohmann::detail::to_json_fn>::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
5> with
5> [
5> T=nlohmann::detail::to_json_fn
5> ]
5> C:\Temp\json-develop\src\json.hpp(898): note: see reference to class template instantiation 'nlohmann::detail::static_const<nlohmann::detail::to_json_fn>' being compiled
5>C:\Temp\json-develop\src\json.hpp(887): error C2131: expression did not evaluate to a constant
5> C:\Temp\json-develop\src\json.hpp(887): note: failure was caused by returning the address of or a reference to a temporary
5>C:\Temp\json-develop\src\json.hpp(887): error C4579: 'nlohmann::detail::static_const<nlohmann::detail::from_json_fn>::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
5> with
5> [
5> T=nlohmann::detail::from_json_fn
5> ]
5> C:\Temp\json-develop\src\json.hpp(899): note: see reference to class template instantiation 'nlohmann::detail::static_const<nlohmann::detail::from_json_fn>' being compiled
5>C:\Temp\json-develop\src\json.hpp(6482): error C2784: '_Ty *std::begin(_Ty (&)[_Size]) noexcept': could not deduce template argument for '_Ty (&)[_Size]' from 'add_rvalue_reference<const ContiguousContainer>::type'
5> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xutility(1250): note: see declaration of 'std::begin'
5> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(761): note: see reference to class template instantiation 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>' being compiled
5> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(790): note: see reference to class template instantiation 'std::is_nothrow_constructible<_Ty,nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer> &&>' being compiled
5> with
5> [
5> _Ty=nlohmann::json
5> ]
5> C:\Temp\json-develop\src\json.hpp(12931): note: see reference to class template instantiation 'std::is_nothrow_move_constructible<nlohmann::json>' being compiled
5>C:\Temp\json-develop\src\json.hpp(6482): error C2893: Failed to specialize function template 'unknown-type std::begin(const _Container &)'
5> C:\Temp\json-develop\src\json.hpp(6482): note: With the following template arguments:
5> C:\Temp\json-develop\src\json.hpp(6482): note: '_Container=add_rvalue_reference<const ContiguousContainer>::type'
5>C:\Temp\json-develop\src\json.hpp(6482): error C2893: Failed to specialize function template 'unknown-type std::begin(_Container &)'
5> C:\Temp\json-develop\src\json.hpp(6482): note: With the following template arguments:
5> C:\Temp\json-develop\src\json.hpp(6482): note: '_Container=add_rvalue_reference<const ContiguousContainer>::type'
5>C:\Temp\json-develop\src\json.hpp(6482): error C2784: 'const _Elem *std::begin(std::initializer_list<_Elem>) noexcept': could not deduce template argument for 'std::initializer_list<_Elem>' from 'add_rvalue_reference<const ContiguousContainer>::type'
5> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\initializer_list(60): note: see declaration of 'std::begin'
6>------ Build started: Project: ALL_BUILD, Configuration: Debug Win32 ------
6> Building Custom Rule C:/Temp/json-develop/CMakeLists.txt
6> CMake does not need to re-run because C:\Temp\json-develop\build\CMakeFiles\generate.stamp is up-to-date.
7>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------
7>Project not selected to build for this solution configuration
========== Build: 3 succeeded, 1 failed, 0 up-to-date, 3 skipped ==========
I don't know if there is a workaround to that...
You could send a message to the ranges-v3 maintainers to ask them if they encountered this problem before upgrading to Visual 2015, (the static_const machinery comes from them).
You could also try to replace const auto& by auto&& at lines 898-899, but I'm 99% certain it won't help.
Sorry!
It did not compiled claiming that the expression is not constant. The error:
3>------ Build started: Project: json_unit, Configuration: Debug Win32 ------
3> unit-algorithms.cpp
3>C:\Temp\json-develop\src\json.hpp(887): error C4579: 'nlohmann::detail::static_const<nlohmann::detail::to_json_fn>::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
3> with
3> [
3> T=nlohmann::detail::to_json_fn
3> ]
3> C:\Temp\json-develop\src\json.hpp(898): note: see reference to class template instantiation 'nlohmann::detail::static_const<nlohmann::detail::to_json_fn>' being compiled
3>C:\Temp\json-develop\src\json.hpp(887): error C2131: expression did not evaluate to a constant
3> C:\Temp\json-develop\src\json.hpp(887): note: failure was caused by returning the address of or a reference to a temporary
3>C:\Temp\json-develop\src\json.hpp(887): error C4579: 'nlohmann::detail::static_const<nlohmann::detail::from_json_fn>::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
3> with
3> [
3> T=nlohmann::detail::from_json_fn
3> ]
3> C:\Temp\json-develop\src\json.hpp(899): note: see reference to class template instantiation 'nlohmann::detail::static_const<nlohmann::detail::from_json_fn>' being compiled
3>C:\Temp\json-develop\src\json.hpp(6482): error C2784: '_Ty *std::begin(_Ty (&)[_Size]) noexcept': could not deduce template argument for '_Ty (&)[_Size]' from 'add_rvalue_reference<const ContiguousContainer>::type'
3> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xutility(1250): note: see declaration of 'std::begin'
3> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(761): note: see reference to class template instantiation 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>' being compiled
3> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(790): note: see reference to class template instantiation 'std::is_nothrow_constructible<_Ty,nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer> &&>' being compiled
3> with
3> [
3> _Ty=nlohmann::json
3> ]
3> C:\Temp\json-develop\src\json.hpp(12931): note: see reference to class template instantiation 'std::is_nothrow_move_constructible<nlohmann::json>' being compiled
3>C:\Temp\json-develop\src\json.hpp(6482): error C2893: Failed to specialize function template 'unknown-type std::begin(const _Container &)'
3> C:\Temp\json-develop\src\json.hpp(6482): note: With the following template arguments:
3> C:\Temp\json-develop\src\json.hpp(6482): note: '_Container=add_rvalue_reference<const ContiguousContainer>::type'
3>C:\Temp\json-develop\src\json.hpp(6482): error C2893: Failed to specialize function template 'unknown-type std::begin(_Container &)'
3> C:\Temp\json-develop\src\json.hpp(6482): note: With the following template arguments:
3> C:\Temp\json-develop\src\json.hpp(6482): note: '_Container=add_rvalue_reference<const ContiguousContainer>::type'
3>C:\Temp\json-develop\src\json.hpp(6482): error C2784: 'const _Elem *std::begin(std::initializer_list<_Elem>) noexcept': could not deduce template argument for 'std::initializer_list<_Elem>' from 'add_rvalue_reference<const ContiguousContainer>::type'
3> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\initializer_list(60): note: see declaration of 'std::begin'
4>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------
4>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 3 skipped ==========
Hi Niels,
we do not have a workaround for this. MSVC2017 works both for your code and for ours, but we can not enforce it as a requirement.
My hope is that an update4 comes out for msvc2015 fixing the outstanding issues with boost, however there is not much more we can do. For the moment we are using rapidjson internally so not a blocker, just a shame since i liked much more your lib.
@nlohmann Thanks for your reply! Compile failed in VS 2015 Enterprise and VS 2015 Professional, but compiled successfully in VS 2015 Community. I don't know what happened. Compile error is as follows:
"nlohmann::detail::static_constnlohmann::detail::to_json_fn::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported..."
@mjrao Are you sure you're using the same update version and compiler settings in both? Sounds like either the community version is a more recent update, or the warning settings are different.
I am trying this library by following all the steps as mentioned by including json.hpp in my project. Here I am also getting the same problem with the following error message.
error C4579: 'nlohmann::detail::static_constnlohmann::detail::from_json_fn::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
I am using vs 2015 Pro with Platform Toolset : Visual Studio 2015 (v140).
Anyone of you found any solution?
I am trying this library by following all the steps as mentioned by including json.hpp in my project. Here I am also getting the same problem with the following error message.
error C4579: 'nlohmann::detail::static_constnlohmann::detail::from_json_fn::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
I am using vs 2015 Pro with Platform Toolset : Visual Studio 2015 (v140).
Anyone of you found any solution?
Thanks @mjrao for your reply. Actually in my organization we only have this version of VS subscription it will take time for them to upgrade this but because I need some solution urgently I have now used RapidJSON. I think this is because of old c++ compiler version. Will try this in latest VS as you mentioned I am sure it will work.
Activity
nlohmann commentedon Feb 23, 2017
I do not know. We use MSVC 19.0.24215.1 in the unit tests on AppVeyor (see https://ci.appveyor.com/project/nlohmann/json for the latest build result). Did you try? What error message did you get?
RiccardoRossi commentedon Feb 23, 2017
Hi, my colleague Pooyan Dadvant will be posting the error.
pooyan-dadvand commentedon Feb 23, 2017
Just to share the error I got while compiling it with my VS build 14.023107.0
1>C:\Kratos\external_libraries\json/json.hpp(887): error C4579: 'nlohmann::detail::static_constnlohmann::detail::to_json_fn::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
1> with
1> [
1> T=nlohmann::detail::to_json_fn
1> ]
1> C:\Kratos\external_libraries\json/json.hpp(898): note: see reference to class template instantiation 'nlohmann::detail::static_constnlohmann::detail::to_json_fn' being compiled
1>C:\Kratos\external_libraries\json/json.hpp(887): error C2131: expression did not evaluate to a constant
1> C:\Kratos\external_libraries\json/json.hpp(887): note: failure was caused by returning the address of or a reference to a temporary
1>C:\Kratos\external_libraries\json/json.hpp(887): error C4579: 'nlohmann::detail::static_constnlohmann::detail::from_json_fn::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported
1> with
1> [
1> T=nlohmann::detail::from_json_fn
1> ]
1> C:\Kratos\external_libraries\json/json.hpp(899): note: see reference to class template instantiation 'nlohmann::detail::static_constnlohmann::detail::from_json_fn' being compiled
1>C:\Kratos\external_libraries\json/json.hpp(6482): error C2784: '_Ty *std::begin(_Ty (&)[_Size]) noexcept': could not deduce template argument for '_Ty (&)[_Size]' from 'add_rvalue_reference::type'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xutility(1250): note: see declaration of 'std::begin'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(761): note: see reference to class template instantiation 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer' being compiled
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(790): note: see reference to class template instantiation 'std::is_nothrow_constructible<_Ty,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &&>' being compiled
1> with
1> [
1> _Ty=nlohmann::json
1> ]
1> C:\Kratos\external_libraries\json/json.hpp(12912): note: see reference to class template instantiation 'std::is_nothrow_move_constructiblenlohmann::json' being compiled
1>C:\Kratos\external_libraries\json/json.hpp(6482): error C2893: Failed to specialize function template 'unknown-type std::begin(const _Container &)'
1> C:\Kratos\external_libraries\json/json.hpp(6482): note: With the following template arguments:
1> C:\Kratos\external_libraries\json/json.hpp(6482): note: '_Container=add_rvalue_reference::type'
1>C:\Kratos\external_libraries\json/json.hpp(6482): error C2893: Failed to specialize function template 'unknown-type std::begin(_Container &)'
1> C:\Kratos\external_libraries\json/json.hpp(6482): note: With the following template arguments:
1> C:\Kratos\external_libraries\json/json.hpp(6482): note: '_Container=add_rvalue_reference::type'
1>C:\Kratos\external_libraries\json/json.hpp(6482): error C2784: 'const _Elem *std::begin(std::initializer_list<_Elem>) noexcept': could not deduce template argument for 'std::initializer_list<_Elem>' from 'add_rvalue_reference::type'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\initializer_list(60): note: see declaration of 'std::begin'
1>C:\Kratos\kratos\includes/kratos_parameters.h(174): error C2665: 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse': none of the 2 overloads could convert all the argument types
1> C:\Kratos\external_libraries\json/json.hpp(6361): note: could be 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &&,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\external_libraries\json/json.hpp(6352): note: or 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\kratos\includes/kratos_parameters.h(174): note: while trying to match the argument list '(const std::string)'
1>C:\Kratos\kratos\includes/kratos_parameters.h(183): error C2665: 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse': none of the 2 overloads could convert all the argument types
1> C:\Kratos\external_libraries\json/json.hpp(6361): note: could be 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &&,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\external_libraries\json/json.hpp(6352): note: or 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\kratos\includes/kratos_parameters.h(183): note: while trying to match the argument list '(const std::string)'
1>C:\Kratos\kratos\includes/kratos_parameters.h(188): error C2665: 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse': none of the 2 overloads could convert all the argument types
1> C:\Kratos\external_libraries\json/json.hpp(6361): note: could be 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &&,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\external_libraries\json/json.hpp(6352): note: or 'nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse(std::istream &,const std::function<bool (int,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer::parse_event_t,nlohmann::basic_jsonstd::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer &)>)'
1> C:\Kratos\kratos\includes/kratos_parameters.h(188): note: while trying to match the argument list '(const std::string)'
nlohmann commentedon Feb 23, 2017
Thanks. Could you compile the unit tests?
pooyan-dadvand commentedon Feb 23, 2017
I have try to compile the unit testing with a clone of the current repository version and gives me the same compilation error.
nlohmann commentedon Feb 23, 2017
Could you please post the error from compiling the unit tests as well, because then we have the complete picture where the error first occurs.
Well, I am no expert in MSVC. It seems as if AppVeyor is using a slightly more modern version (just comparing the build version numbers). Is that Update 3?
pooyan-dadvand commentedon Feb 24, 2017
The update 3 is more modern but it is incompatible with boost library which we are using....
I will send you the error when I arrive to my office
pooyan-dadvand commentedon Feb 24, 2017
here you have the output:
nlohmann commentedon Feb 24, 2017
@theodelrieu Any idea on this? MSVC seems to have an issue with
static_const.theodelrieu commentedon Feb 24, 2017
I don't know if there is a workaround to that...
You could send a message to the ranges-v3 maintainers to ask them if they encountered this problem before upgrading to Visual 2015, (the
static_constmachinery comes from them).You could also try to replace
const auto&byauto&&at lines 898-899, but I'm 99% certain it won't help.Sorry!
nlohmann commentedon Feb 28, 2017
@pooyan-dadvand Did you try the hack proposed by @theodelrieu?
pooyan-dadvand commentedon Feb 28, 2017
Not yet... l will do it ASAP!
pooyan-dadvand commentedon Mar 1, 2017
It did not compiled claiming that the expression is not constant. The error:
nlohmann commentedon Mar 3, 2017
@pooyan-dadvand This is a pity, but I think we cannot help you right now.
6 remaining items
RiccardoRossi commentedon Mar 11, 2017
Hi Niels,
we do not have a workaround for this. MSVC2017 works both for your code and for ours, but we can not enforce it as a requirement.
My hope is that an update4 comes out for msvc2015 fixing the outstanding issues with boost, however there is not much more we can do. For the moment we are using rapidjson internally so not a blocker, just a shame since i liked much more your lib.
in any case thank you for your time and effort.
ai0376 commentedon Oct 16, 2018
vs community 2015 run ok!
pooyan-dadvand commentedon Oct 16, 2018
Good news! Thanks for notification!
@RiccardoRossi we should give it another try then
nlohmann commentedon Oct 16, 2018
@mjrao I am not using MSVC myself. Is "vs community 2015" something different than "msvc2015"?
gregmarr commentedon Oct 16, 2018
Visual Studio Community 2015 is the same as Visual Studio Professional 2015 but with a different license.
nlohmann commentedon Oct 18, 2018
Thanks for the info. So I can keep the README as is, because there is no additional supported compiler or version.
ai0376 commentedon Oct 21, 2018
@nlohmann Thanks for your reply! Compile failed in VS 2015 Enterprise and VS 2015 Professional, but compiled successfully in VS 2015 Community. I don't know what happened. Compile error is as follows:
"nlohmann::detail::static_constnlohmann::detail::to_json_fn::value': in-class initialization for type 'const T' is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported..."
nlohmann commentedon Oct 21, 2018
Can you try the
developversion and provide the complete error message with line numbers?gregmarr commentedon Oct 22, 2018
@mjrao Are you sure you're using the same update version and compiler settings in both? Sounds like either the community version is a more recent update, or the warning settings are different.
ai0376 commentedon Oct 23, 2018
VS 2015 Community Vesion: 14.0.25420.01 Update 3 @gregmarr
luomomo commentedon Jun 26, 2019
Hi ,I meet the problem in vs2015 :C2440,cannot convert from 'initializer-list' to nlohmann::basic_json ,is anyone know how to solve this?
satyamsameer commentedon Jun 30, 2020
Hi Everyone,
I am trying this library by following all the steps as mentioned by including json.hpp in my project. Here I am also getting the same problem with the following error message.
I am using vs 2015 Pro with Platform Toolset : Visual Studio 2015 (v140).
Anyone of you found any solution?
Thanks in advance
ai0376 commentedon Jun 30, 2020
use VS 2015 Community. or try vs2019 ?
satyamsameer commentedon Jul 1, 2020
Thanks @mjrao for your reply. Actually in my organization we only have this version of VS subscription it will take time for them to upgrade this but because I need some solution urgently I have now used RapidJSON. I think this is because of old c++ compiler version. Will try this in latest VS as you mentioned I am sure it will work.