Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supported compilers #50

Closed
suy opened this issue Mar 24, 2015 · 5 comments
Closed

Supported compilers #50

suy opened this issue Mar 24, 2015 · 5 comments

Comments

@suy
Copy link

suy commented Mar 24, 2015

Hi.

There is no documentation on what compilers are supported, or which C++ features are required. I've tried to include the header in a project with MSVC 2013, and I get plenty of compile errors (with MinGW it compiles fine). I know MSVC might not have good enough C++11 support, so that's somewhat expected. I'm wondering, though, if anybody has attempted some newer pre-release of MSVC and if it is worth it at all trying to get it compile, sending patches, etc.

Thank you.

PD: In case it's useful, the first error I have is with the declaration of using iterator = basic_json::iterator:

c:\users\alex\documents\helloworld\json/src/json.hpp(142) : error C2061: syntax error : identifier 'iterator'
        c:\users\alex\documents\helloworld\json/src/json.hpp(4335) : see reference to class template instantiation 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,Allocator>' being compiled
c:\users\alex\documents\helloworld\json/src/json.hpp(142) : error C2238: unexpected token(s) preceding ';'

Later on I get plenty of unrecognized noexcept. The later could be worked around with a macro, I think, but I have no idea on the former, or other template magic involved.

@nlohmann
Copy link
Owner

Hi @suy,

thanks for checking by. Unfortunately, MSVC's C++11 support is still very bad. I got some pull requests where the library has been "fixed" to compile, but these changes were a preprocessor nightmare. I would also like to know how more recent versions behave.

I agree that a documentation of supported compilers would be really useful. I shall add a table to the README file and hope to get some feedback about other compilers. By the way, which compiler with MinGW did you try?

@suy
Copy link
Author

suy commented Mar 24, 2015

El Tuesday 24 March 2015, Niels escribió:

thanks for checking by. Unfortunately, MSVC's C++11 support is still very
bad. I got some pull requests where the library has been "fixed" to
compile, but these changes were a preprocessor nightmare.

That's what I've always been told, and in this case I can confirm. Many errors
were repeated (e.g. the lack of understanding of no_except), but the compiler
stopped at the 100th error. So yeah, very problematic.

I would also
like to know how more recent versions behave.

My version was 2013. I've read that people are happy about the 2015 pre-
releases, but I don't have access to that myself.

I agree that a documentation of supported compilers would be really useful.
I shall add a table to the README file and hope to get some feedback about
other compilers. By the way, which compiler with MinGW did you try?

Thank you! Any mention of what compilers (and maybe their versions) people
have reported success will be excellent. So far I can report success with
MinGW 4.9.1. I can try with others if you need help in that. Thanks again.

@MPolovyi
Copy link

@suy I've just tried with the 2015 (actually, 2014, but nonetheless the latest version), and it gave me much less errors then the 2013. But the "iterator" error you reposted is still there.

if anybody is interested, I include the output of errors... can't really say why they arise, or what are they about - cpp is not my best side :)

1>  stdafx.cpp
1>\json.hpp(144): error C2061: syntax error: identifier 'iterator'
1>  \json.hpp(4523): note: see reference to class template instantiation 'nlohmann::basic_json<ObjectType,ArrayType,StringType,BooleanType,NumberIntegerType,NumberFloatType,Allocator>' being compiled
1>\json.hpp(144): error C2238: unexpected token(s) preceding ';'
1>\json.hpp(150): error C2061: syntax error: identifier 'const_iterator'
1>\json.hpp(150): error C2238: unexpected token(s) preceding ';'
1>\json.hpp(156): error C2061: syntax error: identifier 'reverse_iterator'
1>\json.hpp(156): error C2238: unexpected token(s) preceding ';'
1>\json.hpp(162): error C2061: syntax error: identifier 'const_reverse_iterator'
1>\json.hpp(162): error C2238: unexpected token(s) preceding ';'
1>\json.hpp(409): warning C4346: 'std::is_constructible<StringType,V::key_type>::value': dependent name is not a type
1>  \json.hpp(409): note: prefix with 'typename' to indicate a type
1>\json.hpp(409): error C2146: syntax error: missing '>' before identifier 'and'
1>\json.hpp(409): error C2993: 'std::enable_if<std::is_constructible<StringType,V::key_type>::value,void>': illegal type for non-type template parameter 'public: static bool const std::integral_constant<bool,0>::value'
1>\json.hpp(2049): error C2988: unrecognizable template declaration/definition
1>\json.hpp(2049): error C2059: syntax error: '<end Parse>'
1>\json.hpp(2052): error C2238: unexpected token(s) preceding ';'
1>\json.hpp(177): error C2976: 'std::map': too few template arguments
1>  c:\program files (x86)\microsoft visual studio 14.0\vc\include\map(69): note: see declaration of 'std::map'
1>  c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(810): note: see reference to class template instantiation 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,double,std::allocator>' being compiled
1>  c:\program files (x86)\microsoft visual studio 14.0\vc\include\type_traits(842): note: see reference to class template instantiation 'std::is_nothrow_constructible<_Ty,nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,double,std::allocator> &&>' being compiled
1>          with
1>          [
1>              _Ty=nlohmann::json
1>          ]
1>  \json.hpp(4549): note: see reference to class template instantiation 'std::is_nothrow_move_constructible<nlohmann::json>' being compiled
1>\json.hpp(179): error C2976: 'std::vector': too few template arguments
1>  c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector(659): note: see declaration of 'std::vector'
1>\json.hpp(409): error C2993: 'std::enable_if<std::is_constructible<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,V::key_type>::value,void>': illegal type for non-type template parameter 'public: static bool const std::integral_constant<bool,0>::value'
1>\json.hpp(4550): error C2146: syntax error: missing ')' before identifier 'and'
1>\json.hpp(4553): error C2039: 'swap': is not a member of 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,double,std::allocator>'
1>\json.hpp(4565): error C2039: 'dump': is not a member of 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,double,std::allocator>'
1>\json.hpp(4580): error C2039: 'parse': is not a member of 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,double,std::allocator>'
1>\json.hpp(4580): error C3861: 'parse': identifier not found

@suy
Copy link
Author

suy commented Apr 11, 2015

Thank you!

@nlohmann
Copy link
Owner

Hi @suy and @MPolovyi, I made some changes for ticket #62 which may affect MSVC support. Maybe you can check whether MSVC 2015 support is now better.

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

No branches or pull requests

3 participants