Guest
Login
跳过导航链接

Compile Error:

  : In function 'int main()':
:10:45: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int, const char [2])'
   10 |                         cout<<string(n-i," ");
      |                                             ^
In file included from D:/msys64/ucrt64/include/c++/13.2.0/string:54,
                 from D:/msys64/ucrt64/include/c++/13.2.0/bits/locale_classes.h:40,
                 from D:/msys64/ucrt64/include/c++/13.2.0/bits/ios_base.h:41,
                 from D:/msys64/ucrt64/include/c++/13.2.0/ios:44,
                 from D:/msys64/ucrt64/include/c++/13.2.0/ostream:40,
                 from D:/msys64/ucrt64/include/c++/13.2.0/iostream:41,
                 from :1:
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:609:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long long unsigned int]' (near match)
  609 |       basic_string(const _CharT* __s, size_type __n,
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:609:7: note:   conversion of argument 2 would be ill-formed:
:10:42: error: invalid conversion from 'const char*' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long long unsigned int'} [-fpermissive]
   10 |                         cout<<string(n-i," ");
      |                                          ^~~
      |                                          |
      |                                          const char*
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:783:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  783 |         basic_string(const _Tp& __t, const _Alloc& __a = _Alloc())
      |         ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:783:9: note:   template argument deduction/substitution failed:
In file included from D:/msys64/ucrt64/include/c++/13.2.0/bits/move.h:37,
                 from D:/msys64/ucrt64/include/c++/13.2.0/bits/exception_ptr.h:41,
                 from D:/msys64/ucrt64/include/c++/13.2.0/exception:164,
                 from D:/msys64/ucrt64/include/c++/13.2.0/ios:41:
D:/msys64/ucrt64/include/c++/13.2.0/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]':
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:144:8:   required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value, _Res> [with _Tp = int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:780:30:   required from here
D:/msys64/ucrt64/include/c++/13.2.0/type_traits:2610:11: error: no type named 'type' in 'struct std::enable_if<false, void>'
 2610 |     using enable_if_t = typename enable_if<_Cond, _Tp>::type;
      |           ^~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:771:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  771 |         basic_string(const _Tp& __t, size_type __pos, size_type __n,
      |         ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:771:9: note:   template argument deduction/substitution failed:
:10:45: note:   candidate expects 4 arguments, 2 provided
   10 |                         cout<<string(n-i," ");
      |                                             ^
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:748:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  748 |         basic_string(_InputIterator __beg, _InputIterator __end,
      |         ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:748:9: note:   template argument deduction/substitution failed:
:10:45: note:   deduced conflicting types for parameter '_InputIterator' ('int' and 'const char*')
   10 |                         cout<<string(n-i," ");
      |                                             ^
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:654:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  654 |       basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:654:7: note:   template argument deduction/substitution failed:
:10:42: note:   cannot convert '" "' (type 'const char [2]') to type 'char'
   10 |                         cout<<string(n-i," ");
      |                                          ^~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:631:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  631 |       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:631:7: note:   template argument deduction/substitution failed:
:10:39: note:   cannot convert '(n - i)' (type 'int') to type 'const char*'
   10 |                         cout<<string(n-i," ");
      |                                      ~^~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:705:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  705 |       basic_string(basic_string&& __str, const _Alloc& __a)
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:705:35: note:   no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>&&'
  705 |       basic_string(basic_string&& __str, const _Alloc& __a)
      |                    ~~~~~~~~~~~~~~~^~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:700:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  700 |       basic_string(const basic_string& __str, const _Alloc& __a)
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:700:40: note:   no known conversion for argument 1 from 'int' to 'const std::__cxx11::basic_string<char>&'
  700 |       basic_string(const basic_string& __str, const _Alloc& __a)
      |                    ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:695:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  695 |       basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:695:45: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<char>'
  695 |       basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:667:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  667 |       basic_string(basic_string&& __str) noexcept
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:667:7: note:   candidate expects 1 argument, 2 provided
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:589:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long long unsigned int]'
  589 |       basic_string(const basic_string& __str, size_type __pos,
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:589:7: note:   candidate expects 4 arguments, 2 provided
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:571:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long long unsigned int]'
  571 |       basic_string(const basic_string& __str, size_type __pos,
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:571:7: note:   candidate expects 3 arguments, 2 provided
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:554:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long long unsigned int]'
  554 |       basic_string(const basic_string& __str, size_type __pos,
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:554:40: note:   no known conversion for argument 1 from 'int' to 'const std::__cxx11::basic_string<char>&'
  554 |       basic_string(const basic_string& __str, size_type __pos,
      |                    ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:537:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  537 |       basic_string(const basic_string& __str)
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:537:7: note:   candidate expects 1 argument, 2 provided
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:525:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  525 |       basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:525:7: note:   candidate expects 1 argument, 2 provided
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:512:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  512 |       basic_string()
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:512:7: note:   candidate expects 0 arguments, 2 provided
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:176:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(__sv_wrapper, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  176 |       basic_string(__sv_wrapper __svw, const _Alloc& __a)
      |       ^~~~~~~~~~~~
D:/msys64/ucrt64/include/c++/13.2.0/bits/basic_string.h:176:33: note:   no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>::__sv_wrapper'
  176 |       basic_string(__sv_wrapper __svw, const _Alloc& __a)
      |                    ~~~~~~~~~~~~~^~~~~

  

Zhe Jiang University Of Technology Online Programming Space Beta1.3
Designed & Developped By Jin Qiwei
Refactored By cb@zjut.edu.cn , QQ Group: 723311416  All Copyright Reserved 2006-
685