Skip to content

编译不成功(error: call of overloaded ‘vector(nlohmann::basic_json<>&)’ is ambiguous) #22

Open
@liansh2002

Description

@liansh2002

想在Raspberry pi上使用,所以先试下在PC上自行编译安装,但编译不成功。
编译环境:
x86_64,Debian 10,gcc (Debian 8.3.0-6),nlohmann-json3-dev/now 3.9.0-1 all,cmake version 3.18.2

错误信息
[ 40%] Building CXX object src/CMakeFiles/main.dir/config.cpp.o /usr/local/etc/app/cgproxy/src/config.cpp: In member function ‘bool CGPROXY::CONFIG::Config::validateJsonStr(std::__cxx11::string)’: /usr/local/etc/app/cgproxy/src/config.cpp:127:60: error: call of overloaded ‘vector(nlohmann::basic_json<>&)’ is ambiguous if (value.is_array() && !validCgroup((vector<string>)value)) status = false; ^~~~~ In file included from /usr/include/c++/8/vector:64, from /usr/local/etc/app/cgproxy/build/src/common.h:7, from /usr/local/etc/app/cgproxy/src/config.h:3, from /usr/local/etc/app/cgproxy/src/config.cpp:1: /usr/include/c++/8/bits/stl_vector.h:515:7: note: candidate: ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::__cxx11::basic_string<char> >]’ vector(initializer_list<value_type> __l, ^~~~~~ /usr/include/c++/8/bits/stl_vector.h:476:7: note: candidate: ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]’ vector(vector&& __x) noexcept ^~~~~~ /usr/include/c++/8/bits/stl_vector.h:458:7: note: candidate: ‘std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]’ vector(const vector& __x) ^~~~~~ /usr/include/c++/8/bits/stl_vector.h:415:7: note: candidate: ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::__cxx11::basic_string<char> >]’ vector(size_type __n, const allocator_type& __a = allocator_type()) ^~~~~~ make[2]: *** [src/CMakeFiles/main.dir/build.make:108: src/CMakeFiles/main.dir/config.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:184: src/CMakeFiles/main.dir/all] Error 2 make: *** [Makefile:171: all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions