Skip to content

Building with Visual Studio 2019 #1619

@lorisleitner

Description

@lorisleitner

Is anyone able to use the library with Visual Studio 2019?

  • Describe what you want to achieve.
    Use the single include header with a Visual Studio 2019 project. Just including it yields about 1500 errors.
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1032,51): error C2059:  syntax error: 'is_detected<nlohmann::detail::key_type_t,CompatibleObjectType>::value'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1043,4): error C2976:  'nlohmann::detail::is_compatible_object_type_impl': too few template arguments
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1029): message :  see declaration of 'nlohmann::detail::is_compatible_object_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1047,1): error C2955:  'nlohmann::detail::is_compatible_object_type_impl': use of class template requires template argument list
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1029): message :  see declaration of 'nlohmann::detail::is_compatible_object_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1047): message :  see reference to class template instantiation 'nlohmann::detail::is_compatible_object_type<BasicJsonType,CompatibleObjectType>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1057,54): error C2059:  syntax error: 'is_detected<nlohmann::detail::key_type_t,CompatibleObjectType>::value'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1075,4): error C2976:  'nlohmann::detail::is_constructible_object_type_impl': too few template arguments
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1054): message :  see declaration of 'nlohmann::detail::is_constructible_object_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1080,1): error C2955:  'nlohmann::detail::is_constructible_object_type_impl': use of class template requires template argument list
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1054): message :  see declaration of 'nlohmann::detail::is_constructible_object_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1080): message :  see reference to class template instantiation 'nlohmann::detail::is_constructible_object_type<BasicJsonType,ConstructibleObjectType>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1126,50): error C2059:  syntax error: 'is_detected<nlohmann::detail::iterator_t,CompatibleArrayType>::value'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1136,4): error C2976:  'nlohmann::detail::is_compatible_array_type_impl': too few template arguments
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1123): message :  see declaration of 'nlohmann::detail::is_compatible_array_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1140,1): error C2955:  'nlohmann::detail::is_compatible_array_type_impl': use of class template requires template argument list
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1123): message :  see declaration of 'nlohmann::detail::is_compatible_array_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1140): message :  see reference to class template instantiation 'nlohmann::detail::is_compatible_array_type<BasicJsonType,CompatibleArrayType>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1157,59): error C2059:  syntax error: 'std::is_default_constructible<ConstructibleArrayType>::value'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1179,4): error C2976:  'nlohmann::detail::is_constructible_array_type_impl': too few template arguments
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1153): message :  see declaration of 'nlohmann::detail::is_constructible_array_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1183,1): error C2955:  'nlohmann::detail::is_constructible_array_type_impl': use of class template requires template argument list
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1153): message :  see declaration of 'nlohmann::detail::is_constructible_array_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1183): message :  see reference to class template instantiation 'nlohmann::detail::is_constructible_array_type<BasicJsonType,ConstructibleArrayType>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1193,51): error C2059:  syntax error: 'std::is_integral<CompatibleNumberIntegerType>::value'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1205,4): error C2976:  'nlohmann::detail::is_compatible_integer_type_impl': too few template arguments
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1190): message :  see declaration of 'nlohmann::detail::is_compatible_integer_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1210,1): error C2955:  'nlohmann::detail::is_compatible_integer_type_impl': use of class template requires template argument list
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1190): message :  see declaration of 'nlohmann::detail::is_compatible_integer_type_impl'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(1210): message :  see reference to class template instantiation 'nlohmann::detail::is_compatible_integer_type<RealIntegerType,CompatibleNumberIntegerType>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2630,66): error C2059:  syntax error: 'std::is_integral<std::remove_pointer<_Ty>::type>::value'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2632,9): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2632,9): warning C4346:  'std::is_pointer<_Ty>::valueand': dependent name is not a type
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2632,9): message :  prefix with 'typename' to indicate a type
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2632): error C2062:  type 'unknown-type' unexpected
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2632,11): error C2039:  'type': is not a member of '`global namespace''
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2634,5): error C2334:  unexpected token(s) preceding ':'; skipping apparent function body
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2710,1): error C2059:  syntax error: '}'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2710,1): error C2143:  syntax error: missing ';' before '}'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2608,7): error C2614:  'nlohmann::detail::input_adapter': illegal member initialization: 'ia' is not a base or member
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2611,7): error C2614:  'nlohmann::detail::input_adapter': illegal member initialization: 'ia' is not a base or member
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2615,7): error C2614:  'nlohmann::detail::input_adapter': illegal member initialization: 'ia' is not a base or member
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2618,7): error C2614:  'nlohmann::detail::input_adapter': illegal member initialization: 'ia' is not a base or member
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2621,7): error C2614:  'nlohmann::detail::input_adapter': illegal member initialization: 'ia' is not a base or member
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2624,7): error C2614:  'nlohmann::detail::input_adapter': illegal member initialization: 'ia' is not a base or member
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2965,19): error C2039:  'exception': is not a member of 'nlohmann::nlohmann::detail'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2843): message :  see declaration of 'nlohmann::nlohmann::detail'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3037): message :  see reference to class template instantiation 'nlohmann::nlohmann::detail::json_sax_dom_parser<BasicJsonType>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2965,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2965,28): error C2143:  syntax error: missing ',' before '&'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2971,15): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2974,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2976,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2979,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2981,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2983,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3211,19): error C2039:  'exception': is not a member of 'nlohmann::nlohmann::detail'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2843): message :  see declaration of 'nlohmann::nlohmann::detail'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3341): message :  see reference to class template instantiation 'nlohmann::nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3211,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3211,28): error C2143:  syntax error: missing ',' before '&'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3217,15): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3220,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3222,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3225,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3227,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3229,7): error C3861:  'ex': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3407,90): error C2039:  'exception': is not a member of 'nlohmann::nlohmann::detail'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(2843): message :  see declaration of 'nlohmann::nlohmann::detail'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3411): message :  see reference to class template instantiation 'nlohmann::nlohmann::detail::json_sax_acceptor<BasicJsonType>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3407,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3407,99): error C2143:  syntax error: missing ',' before '&'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3593,1): error C2061:  syntax error: identifier 'input_adapter_t'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5527): message :  see reference to class template instantiation 'nlohmann::nlohmann::detail::binary_reader<BasicJsonType,SAX>' being compiled
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3613,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3613,40): error C2146:  syntax error: missing ')' before identifier 'format'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3613,1): error C3646:  'format': unknown override specifier
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3614,15): error C2143:  syntax error: missing ';' before '*'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3614,1): error C2377:  'nlohmann::nlohmann::detail::binary_reader<BasicJsonType,SAX>::json_sax_t': redefinition; typedef cannot be overloaded with any other symbol
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3585): message :  see declaration of 'nlohmann::nlohmann::detail::binary_reader<BasicJsonType,SAX>::json_sax_t'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3615,1): error C2059:  syntax error: ')'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3616,1): error C2334:  unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5390,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5390,41): error C2146:  syntax error: missing ')' before identifier 'format'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5390,1): error C3646:  'format': unknown override specifier
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5390,1): error C2988:  unrecognizable template declaration/definition
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5390,1): error C2059:  syntax error: ','
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5390,1): error C2059:  syntax error: ')'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5391,1): error C2334:  unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5433,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5433,41): error C2146:  syntax error: missing ')' before identifier 'format'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5433,1): error C3646:  'format': unknown override specifier
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5433,1): error C2988:  unrecognizable template declaration/definition
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5433,1): error C2059:  syntax error: ','
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5435,1): error C2059:  syntax error: ')'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5436,1): error C2334:  unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5455,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5455,43): error C2146:  syntax error: missing ')' before identifier 'format'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5455,1): error C3646:  'format': unknown override specifier
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5455,57): error C2062:  type 'char' unexpected
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5456,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5456,4): error C2988:  unrecognizable template declaration/definition
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5456,4): error C2059:  syntax error: '{'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5456,1): error C2334:  unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5471,1): error C2061:  syntax error: identifier 'cr'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5471,1): error C2059:  syntax error: ')'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5471,89): error C2988:  unrecognizable template declaration/definition
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5471,89): error C2143:  syntax error: missing ')' before ';'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5471,1): error C2838:  'snprintf': illegal qualified name in member declaration
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5472,1): error C2988:  unrecognizable template declaration/definition
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5472,1): error C2059:  syntax error: 'return'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5472,1): error C2334:  unexpected token(s) preceding '{'; skipping apparent function body
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3593,54): error C3861:  'ia': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3593,67): error C3861:  'adapter': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3596,5): error C3861:  'ia': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3688,5): error C3861:  'get_number': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3690,9): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3700,12): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3720,10): error C3861:  'current': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3724,33): error C3861:  'current': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3747,13): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3747,13): message :  This diagnostic occurred in the compiler generated function 'bool nlohmann::nlohmann::detail::binary_reader<BasicJsonType,SAX>::get_bson_string(const NumberType,BasicJsonType::string_t &)'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3747,30): error C3861:  'chars_read': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3747,30): message :  This diagnostic occurred in the compiler generated function 'bool nlohmann::nlohmann::detail::binary_reader<BasicJsonType,SAX>::get_bson_string(const NumberType,BasicJsonType::string_t &)'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3747,79): error C3861:  'chars_read': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3747,79): message :  This diagnostic occurred in the compiler generated function 'bool nlohmann::nlohmann::detail::binary_reader<BasicJsonType,SAX>::get_bson_string(const NumberType,BasicJsonType::string_t &)'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3771,30): error C2760:  syntax error: unexpected token ',', expected 'expression'
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3844,54): error C3861:  'chars_read': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3850,31): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3874,5): error C3861:  'get_number': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3876,9): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3886,12): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3902,32): error C3861:  'current': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3933,13): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3933,65): error C3861:  'current': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3938,58): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3944,58): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(3950,58): error C3861:  'sax': identifier not found
1>C:\Users\loris\source\repos\jsontest\jsontest\json.hpp(5473,1): error C1003:  error count exceeds 100; stopping compilation
1>Done building project "jsontest.vcxproj" -- FAILED.
  • Describe what you tried.
    Adding json.hpp to my project

  • Describe which system (OS, compiler) you are using.
    Windows 10 Build 17763, VS 16.1.1, Microsoft (R) C/C++ Optimizing Compiler Version 19.21.27702.2 for x86

  • Describe which version of the library you are using (release version, develop branch).
    Latest release, version 3.6.1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions