Can someone help me to solve the compilation errors? I compiled a simple test source code with g++. The code does compile successfully. However, I get error messages (see below) if I compile the same code with nvcc.
/home/palebluedot/src/json/single_include/nlohmann/json.hpp(14261): warning: pointless comparison of unsigned integer with zero
detected during:
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::__cxx11::string, __nv_bool, int64_t, uint64_t, double, std::allocator, nlohmann::adl_serializer>, NumberType=uint64_t, <unnamed>=0]"
(13896): here
instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType &, __nv_bool, __nv_bool, unsigned int, unsigned int) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::__cxx11::string, __nv_bool, int64_t, uint64_t, double, std::allocator, nlohmann::adl_serializer>]"
(16414): here
instantiation of "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::dump(int, char, __nv_bool, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::error_handler_t) const [with ObjectType=std::map, ArrayType=std::vector, StringType=std::__cxx11::string, BooleanType=__nv_bool, NumberIntegerType=int64_t, NumberUnsignedType=uint64_t, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer]"
(22491): here
/home/palebluedot/src/json/single_include/nlohmann/json.hpp(5215): warning: statement is unreachable
/home/palebluedot/src/json/single_include/nlohmann/json.hpp(10716): warning: statement is unreachable
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2509:151: error: expansion pattern ‘CompatibleObjectType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2509:154: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2509:261: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2509:263: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2534:160: error: expansion pattern ‘ConstructibleObjectType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2534:163: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2534:273: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2534:275: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:196: error: expansion pattern ‘CompatibleStringType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:199: error: template argument 2 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:201: error: template argument 2 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:216: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:218: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:205: error: expansion pattern ‘ConstructibleStringType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:208: error: template argument 2 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:210: error: template argument 2 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:225: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:227: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2603:147: error: expansion pattern ‘CompatibleArrayType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2603:150: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2603:330: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2603:332: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2633:432: error: expansion pattern ‘ConstructibleArrayType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2633:435: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2633:81: error: parse error in template argument list
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9241:11: error: ‘BasicJsonType’ in namespace ‘::’ does not name a type
friend BasicJsonType;
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:474: error: expansion pattern ‘const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>&’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:488: error: expansion pattern ‘ValueType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:491: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:491: error: template argument 5 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:42: error: parse error in template argument list
template < typename ValueType, typename std::enable_if <
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17319:2: error: expected unqualified-id before ‘=’ token
, int >::type = 0 >
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp: In instantiation of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iterator nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::begin() [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iterator = nlohmann::detail::iter_impl<nlohmann::basic_json<> >]’:
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:4639:46: required from ‘bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::end_object() [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8738:26: required from ‘bool nlohmann::detail::parser<BasicJsonType>::sax_parse_internal(SAX*) [with SAX = nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<> >; BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8629:19: required from ‘void nlohmann::detail::parser<BasicJsonType>::parse(bool, BasicJsonType&) [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:20726:1: required from ‘static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::parse(IteratorType, IteratorType, typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t, bool) [with IteratorType = const char*; typename std::enable_if<std::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<_InputIterator>::iterator_category>::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t = std::function<bool(int, nlohmann::detail::parser<nlohmann::basic_json<> >::parse_event_t, nlohmann::basic_json<>&)>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:22544:38: required from here
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9369:15: error: ‘void nlohmann::detail::iter_impl<BasicJsonType>::set_begin() [with BasicJsonType = nlohmann::basic_json<>]’ is private
void set_begin() noexcept
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18521:1: error: within this context
result.set_begin();
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp: In instantiation of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iterator nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::end() [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iterator = nlohmann::detail::iter_impl<nlohmann::basic_json<> >]’:
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:4639:52: required from ‘bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::end_object() [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8738:26: required from ‘bool nlohmann::detail::parser<BasicJsonType>::sax_parse_internal(SAX*) [with SAX = nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<> >; BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8629:19: required from ‘void nlohmann::detail::parser<BasicJsonType>::parse(bool, BasicJsonType&) [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:20726:1: required from ‘static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::parse(IteratorType, IteratorType, typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t, bool) [with IteratorType = const char*; typename std::enable_if<std::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<_InputIterator>::iterator_category>::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t = std::function<bool(int, nlohmann::detail::parser<nlohmann::basic_json<> >::parse_event_t, nlohmann::basic_json<>&)>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:22544:38: required from here
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9406:6: error: ‘void nlohmann::detail::iter_impl<BasicJsonType>::set_end() [with BasicJsonType = nlohmann::basic_json<>]’ is private
void set_end() noexcept
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18592:1: error: within this context
result.set_end();
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp: In instantiation of ‘IteratorType nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::erase(IteratorType) [with IteratorType = nlohmann::detail::iter_impl<nlohmann::basic_json<> >; typename std::enable_if<(std::is_same<InputIT, nlohmann::detail::iter_impl<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> > >::value || std::is_same<InputIT, nlohmann::detail::iter_impl<const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> > >::value), int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer]’:
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:4643:1: required from ‘bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::end_object() [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8738:26: required from ‘bool nlohmann::detail::parser<BasicJsonType>::sax_parse_internal(SAX*) [with SAX = nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<> >; BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8629:19: required from ‘void nlohmann::detail::parser<BasicJsonType>::parse(bool, BasicJsonType&) [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:20726:1: required from ‘static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::parse(IteratorType, IteratorType, typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t, bool) [with IteratorType = const char*; typename std::enable_if<std::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<_InputIterator>::iterator_category>::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t = std::function<bool(int, nlohmann::detail::parser<nlohmann::basic_json<> >::parse_event_t, nlohmann::basic_json<>&)>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:22544:38: required from here
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9830:37: error: ‘nlohmann::basic_json<>* nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_object’ is private
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18087:31: error: within this context
if (JSON_HEDLEY_UNLIKELY(this != pos.m_object))
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18102:26: error: within this context
if (JSON_HEDLEY_UNLIKELY(not pos.m_it.primitive_iterator.is_begin()))
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18122:33: error: within this context
result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18122:33: error: within this context
result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18128:32: error: within this context
result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18128:32: error: within this context
result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
^
CMakeFiles/json-test.dir/build.make:62: recipe for target 'CMakeFiles/json-test.dir/matmul.cu.o' failed
make[2]: *** [CMakeFiles/json-test.dir/matmul.cu.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/json-test.dir/all' failed
make[1]: *** [CMakeFiles/json-test.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Can someone help me to solve the compilation errors? I compiled a simple test source code with g++. The code does compile successfully. However, I get error messages (see below) if I compile the same code with nvcc.