Skip to content

Windows/Visual Studio (through 2013) is unsupported #62

Description

@smiley

I was about to use this for a C++ project in Visual Studio 2013, but the header fails compilation entirely, thanks to a myriad of errors:

1>------ Build started: Project: jsondummy, Configuration: Debug Win32 ------
1>  main.cpp
1>d:\github\jsondummy\src\json.hpp(137): error C2061: syntax error : identifier 'iterator'
1>          d:\github\jsondummy\src\json.hpp(4893) : see reference to class template instantiation 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>' being compiled
1>d:\github\jsondummy\src\json.hpp(137): error C2238: unexpected token(s) preceding ';'
1>d:\github\jsondummy\src\json.hpp(143): error C2061: syntax error : identifier 'const_iterator'
1>d:\github\jsondummy\src\json.hpp(143): error C2238: unexpected token(s) preceding ';'
1>d:\github\jsondummy\src\json.hpp(149): error C2061: syntax error : identifier 'reverse_iterator'
1>d:\github\jsondummy\src\json.hpp(149): error C2238: unexpected token(s) preceding ';'
1>d:\github\jsondummy\src\json.hpp(155): error C2061: syntax error : identifier 'const_reverse_iterator'
1>d:\github\jsondummy\src\json.hpp(155): error C2238: unexpected token(s) preceding ';'
1>d:\github\jsondummy\src\json.hpp(382): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(385): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(402): warning C4346: 'std::is_constructible<ObjectType<StringType,nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,>::key_type,V::key_type>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(402): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(402): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(402): error C2143: syntax error : missing ',' before 'std::is_constructible<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,V::mapped_type>::value'
1>d:\github\jsondummy\src\json.hpp(402): error C2977: 'std::enable_if' : too many template arguments
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtr1common(67) : see declaration of 'std::enable_if'
1>d:\github\jsondummy\src\json.hpp(403): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\github\jsondummy\src\json.hpp(426): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(426): warning C4346: 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::iterator' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(426): error C2923: 'std::is_same' : 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::iterator' is not a valid template type argument for parameter '_Ty2'
1>d:\github\jsondummy\src\json.hpp(426): error C2143: syntax error : missing ',' before 'std::integral_constant<bool,false>::value'
1>d:\github\jsondummy\src\json.hpp(427): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(427): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(427): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(427): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(427): warning C4346: 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::const_iterator' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(427): error C2923: 'std::is_same' : 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::const_iterator' is not a valid template type argument for parameter '_Ty2'
1>d:\github\jsondummy\src\json.hpp(427): error C2143: syntax error : missing ',' before 'std::integral_constant<bool,false>::value'
1>d:\github\jsondummy\src\json.hpp(428): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(428): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(428): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(428): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(428): warning C4346: 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::reverse_iterator' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(428): error C2923: 'std::is_same' : 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::reverse_iterator' is not a valid template type argument for parameter '_Ty2'
1>d:\github\jsondummy\src\json.hpp(428): error C2143: syntax error : missing ',' before 'std::integral_constant<bool,false>::value'
1>d:\github\jsondummy\src\json.hpp(429): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(429): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(429): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(429): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(429): warning C4346: 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::const_reverse_iterator' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(429): error C2923: 'std::is_same' : 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::const_reverse_iterator' is not a valid template type argument for parameter '_Ty2'
1>d:\github\jsondummy\src\json.hpp(429): error C2143: syntax error : missing ',' before 'std::integral_constant<bool,false>::value'
1>d:\github\jsondummy\src\json.hpp(430): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(430): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(430): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(430): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(430): error C2143: syntax error : missing ',' before 'std::is_same<V,ArrayType<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,>::iterator>::value'
1>d:\github\jsondummy\src\json.hpp(431): warning C4346: 'std::is_same<V,ArrayType<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,>::iterator>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(431): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(431): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(431): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(431): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(431): error C2143: syntax error : missing ',' before 'std::is_same<V,ArrayType<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,>::const_iterator>::value'
1>d:\github\jsondummy\src\json.hpp(432): warning C4346: 'std::is_same<V,ArrayType<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,>::const_iterator>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(432): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(432): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(432): error C2143: syntax error : missing ',' before 'std::is_constructible<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,V::value_type>::value'
1>d:\github\jsondummy\src\json.hpp(432): error C2977: 'std::enable_if' : too many template arguments
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtr1common(67) : see declaration of 'std::enable_if'
1>d:\github\jsondummy\src\json.hpp(433): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\github\jsondummy\src\json.hpp(434): error C2535: 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::basic_json(const V &)' : member function already defined or declared
1>          d:\github\jsondummy\src\json.hpp(404) : see declaration of 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::basic_json'
1>d:\github\jsondummy\src\json.hpp(485): warning C4346: 'std::is_constructible<NumberIntegerType,T>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(485): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(485): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(485): error C2143: syntax error : missing ',' before 'std::numeric_limits<T>::is_integer'
1>d:\github\jsondummy\src\json.hpp(485): error C2977: 'std::enable_if' : too many template arguments
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtr1common(67) : see declaration of 'std::enable_if'
1>d:\github\jsondummy\src\json.hpp(486): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\github\jsondummy\src\json.hpp(487): warning C4346: 'std::numeric_limits<T>::is_integer' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(487): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(502): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(594): warning C4346: 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::iterator' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(594): error C2923: 'std::is_same' : 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::iterator' is not a valid template type argument for parameter '_Ty2'
1>d:\github\jsondummy\src\json.hpp(595): error C2146: syntax error : missing ',' before identifier 'or'
1>d:\github\jsondummy\src\json.hpp(595): error C2065: 'or' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(595): warning C4346: 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::const_iterator' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(595): error C2923: 'std::is_same' : 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::const_iterator' is not a valid template type argument for parameter '_Ty2'
1>d:\github\jsondummy\src\json.hpp(596): error C2143: syntax error : missing ',' before 'std::integral_constant<bool,false>::value'
1>d:\github\jsondummy\src\json.hpp(596): error C2977: 'std::enable_if' : too many template arguments
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtr1common(67) : see declaration of 'std::enable_if'
1>d:\github\jsondummy\src\json.hpp(597): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\github\jsondummy\src\json.hpp(748): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(761): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(762): warning C4346: 'std::is_nothrow_move_constructible<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>::value_t>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(762): error C2061: syntax error : identifier 'value'
1>d:\github\jsondummy\src\json.hpp(767): error C2091: function returns function
1>d:\github\jsondummy\src\json.hpp(779): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(838): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(851): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(857): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(863): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(869): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(875): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(881): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(887): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(893): error C3646: 'noexcept' : unknown override specifier
1>d:\github\jsondummy\src\json.hpp(906): warning C4346: 'std::is_convertible<ObjectType<StringType,nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,>::key_type,T::key_type>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(906): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(906): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(907): error C2143: syntax error : missing ',' before 'std::is_convertible<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,T::mapped_type>::value'
1>d:\github\jsondummy\src\json.hpp(907): error C2977: 'std::enable_if' : too many template arguments
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtr1common(67) : see declaration of 'std::enable_if'
1>d:\github\jsondummy\src\json.hpp(907): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\github\jsondummy\src\json.hpp(943): warning C4346: 'std::is_convertible<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,T::value_type>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(943): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(943): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(943): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(943): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(943): error C2143: syntax error : missing ',' before 'std::is_same<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,T::value_type>::value'
1>d:\github\jsondummy\src\json.hpp(944): warning C4346: 'std::is_same<nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,AllocatorType>,T::value_type>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(944): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(944): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(944): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(944): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(944): error C2143: syntax error : missing ',' before 'std::is_arithmetic<T>::value'
1>d:\github\jsondummy\src\json.hpp(945): warning C4346: 'std::is_arithmetic<T>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(945): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(945): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(945): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(945): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(945): error C2143: syntax error : missing ',' before 'std::is_convertible<std::string,T>::value'
1>d:\github\jsondummy\src\json.hpp(946): warning C4346: 'std::is_convertible<std::string,T>::value' : dependent name is not a type
1>          prefix with 'typename' to indicate a type
1>d:\github\jsondummy\src\json.hpp(946): error C2146: syntax error : missing ',' before identifier 'and'
1>d:\github\jsondummy\src\json.hpp(946): error C2065: 'and' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(946): error C2146: syntax error : missing ',' before identifier 'not'
1>d:\github\jsondummy\src\json.hpp(946): error C2065: 'not' : undeclared identifier
1>d:\github\jsondummy\src\json.hpp(947): error C2143: syntax error : missing ',' before 'nlohmann::has_mapped_type<T>::value'
1>d:\github\jsondummy\src\json.hpp(947): error C2977: 'std::enable_if' : too many template arguments
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtr1common(67) : see declaration of 'std::enable_if'
1>d:\github\jsondummy\src\json.hpp(947): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This is on VS2013, and as far as I know it supports 90% of the standard (but not some of what you're using here, like noexcept).

Are you planning to support Visual Studio/Windows some time later on?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions