-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
how to build with clang? #1247
Comments
What did you try? |
@addriumruss Could you please explain what you mean with "build with clang"? The library is a C++ header - it can be build with Clang since version 3.4. |
Hi Lohmann,
thrank you so much for the respone.
I tried these command:
"
mkdir build
cd build
cmake ..
"
it says my gcc version not supported, I set free the gcc version check, but in fact, my gcc is 6.4.0.
after unchecked gcc, executed "make", then got this error:
[root@centos7 build]# make
[ 1%] Built target catch_main
[ 3%] Built target test-iterators1
[ 4%] Building CXX object test/CMakeFiles/test-json_patch.dir/src/unit-json_patch.cpp.o
In file included from /home/russ/file/json/test/src/unit-json_patch.cpp:32:0:
/home/russ/file/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>::insert(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_iterator, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_iterator, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_iterator) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::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<> >; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_iterator = nlohmann::detail::iter_impl<const nlohmann::basic_json<> >]’:
/home/russ/file/json/single_include/nlohmann/json.hpp:18589:25: 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>::diff(const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>&, const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>&, const string&) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; std::string = std::basic_string<char>]’
/home/russ/file/json/test/src/unit-json_patch.cpp:121:13: required from here
/home/russ/file/json/single_include/nlohmann/json.hpp:16174:36: 错误:no match for ‘operator=’ (operand types are ‘std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > >::iterator {aka __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >}’ and ‘void’)
result.m_it.array_iterator = m_value.array->insert(
^
/home/russ/file/json/single_include/nlohmann/json.hpp:16174:36: 附注:备选是:
In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0,
from /usr/include/c++/4.8.2/bits/char_traits.h:39,
from /usr/include/c++/4.8.2/ios:40,
from /usr/include/c++/4.8.2/istream:38,
from /usr/include/c++/4.8.2/sstream:38,
from /home/russ/file/json/test/thirdparty/catch/catch.hpp:384,
from /home/russ/file/json/test/src/unit-json_patch.cpp:30:
/usr/include/c++/4.8.2/bits/stl_iterator.h:708:11: 附注:__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >& __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >::operator=(const __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >&)
class __normal_iterator
^
/usr/include/c++/4.8.2/bits/stl_iterator.h:708:11: 附注: no known conversion for argument 1 from ‘void’ to ‘const __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >’
/usr/include/c++/4.8.2/bits/stl_iterator.h:708:11: 附注:__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >& __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >::operator=(__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >&&)
/usr/include/c++/4.8.2/bits/stl_iterator.h:708:11: 附注: no known conversion for argument 1 from ‘void’ to ‘__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >&&’
make[2]: *** [test/CMakeFiles/test-json_patch.dir/src/unit-json_patch.cpp.o] 错误 1
make[1]: *** [test/CMakeFiles/test-json_patch.dir/all] 错误 2
make: *** [all] 错误 2
[root@centos7 build]#
problem still exists.
can you help figured it out?
Thanks advance~
addriumruss@qq.com
From: Niels Lohmann
Date: 2018-09-23 19:41
To: nlohmann/json
CC: addriumruss; Mention
Subject: Re: [nlohmann/json] how to build with clang? (#1247)
@addriumruss Could you please explain what you mean with "build with clang"? The library is a C++ header - it can be build with Clang since version 3.4.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
[russ@centos7 ~]$ gcc --version |
Your compiler seems to use the STL from GCC 4.8.2. This compiler has not been supported until recently (#1257). You could try if the latest code in the |
Problem not exist any more with the latest code, really appreciated! |
how to build with clang?
The text was updated successfully, but these errors were encountered: