I just downloaded json.hpp and placed it directly in my source folder.
I then include it in my .cc file:
But when I build, I get these errors directly coming from line where I include the json.hpp:
<my source folder>/json.hpp: In instantiation of ‘constexpr const bool nlohmann::detail::is_constructible_object_type_impl<nlohmann::basic_json<>, std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >, void>::value’:
<my source folder>/json.hpp:1407:106: required by substitution of ‘template<class BasicJsonType, class T> decltype ((nlohmann::detail::from_json(j, val), void())) nlohmann::detail::from_json_fn::operator()(const BasicJsonType&, T&) const [with BasicJsonType = nlohmann::basic_json<>; T = std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >]’
<my source folder>/json.hpp:11530:70: required by substitution of ‘template<class BasicJsonType, class ValueType> static decltype ((nlohmann::{anonymous}::from_json(forward<BasicJsonType>(j), val), void())) nlohmann::adl_serializer<T, SFINAE>::from_json(BasicJsonType&&, ValueType&) [with BasicJsonType = BasicJsonType; ValueType = ValueType; <template-parameter-1-1> = std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >; <template-parameter-1-2> = void] [with BasicJsonType = const nlohmann::basic_json<>&; ValueType = std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >]’
<my source folder>/json.hpp:435:73: required by substitution of ‘template<class T, class ... Args> using from_json_function = decltype (T:: from_json((declval<Args>)()...)) [with T = nlohmann::adl_serializer<std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >, void>; Args = {const nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer>&, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer>, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer> > > >&}]’
<my source folder>/json.hpp:362:74: required by substitution of ‘template<class Expected, template<class ...> class Op, class ... Args> using is_detected_exact = std::is_same<Expected, typename nlohmann::detail::detector<nlohmann::detail::nonesuch, void, Op, Args ...>::type> [with Expected = void; Op = nlohmann::detail::from_json_function; Args = {nlohmann::basic_json<>::json_serializer<std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer>, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer> > > >, void>, const nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer>&, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer>, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer> > > >&}]’
<my source folder>/json.hpp:450:27: required from ‘constexpr const bool nlohmann::detail::has_from_json<nlohmann::basic_json<>, std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >, void>::value’
<my source folder>/json.hpp:14047:62: required by substitution of ‘template<class T, class U> using get_template_function = decltype (declval<T>().get<U>()) [with T = const nlohmann::basic_json<>&; U = std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >]’
<my source folder>/json.hpp:14338:20: required from here
<my source folder>/json.hpp:557:63: error: suggest parentheses around ‘&&’ within ‘||’ [-Werror=parentheses]
typename ConstructibleObjectType::mapped_type>::value or
I just downloaded json.hpp and placed it directly in my source folder.
I then include it in my .cc file:
and I define a static method:
But when I build, I get these errors directly coming from line where I include the json.hpp: