记录详情

Compile Error

/in/foo.cc: In function 'int Dd(std::__cxx11::string&, int, int)':
/in/foo.cc:9:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
/in/foo.cc: In function 'int main()':
/in/foo.cc:14:15: error: no matching function for call to 'getline(std::istream&, int&)'
  getline(cin,s);
               ^
In file included from /usr/include/stdio.h:935:0,
                 from /usr/include/c++/6/cstdio:42,
                 from /usr/include/c++/6/ext/string_conversions.h:43,
                 from /usr/include/c++/6/bits/basic_string.h:5417,
                 from /usr/include/c++/6/string:52,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdio.h:115:1: note: candidate: __ssize_t getline(char**, size_t*, FILE*)
 getline (char **__lineptr, size_t *__n, FILE *__stream)
 ^~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdio.h:115:1: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/6/string:52:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/basic_string.h:5395:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     getline(basic_istream<_CharT, _Traits>&& __is,
     ^~~~~~~
/usr/include/c++/6/bits/basic_string.h:5395:5: note:   template argument deduction/substitution failed:
/in/foo.cc:14:15: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
  getline(cin,s);
               ^
In file included from /usr/include/c++/6/string:52:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/basic_string.h:5388:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
     getline(basic_istream<_CharT, _Traits>&& __is,
     ^~~~~~~
/usr/include/c++/6/bits/basic_string.h:5388:5: note:   template argument deduction/substitution failed:
/in/foo.cc:14:15: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
  getline(cin,s);
               ^
In file included from /usr/include/c++/6/string:52:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/basic_string.h:5380:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     getline(basic_istream<_CharT, _Traits>& __is,
     ^~~~~~~
/usr/include/c++/6/bits/basic_string.h:5380:5: note:   template argument deduction/substitution failed:
/in/foo.cc:14:15: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
  getline(cin,s);
               ^
In file included from /usr/include/c++/6/string:53:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/basic_string.tcc:1509:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
     getline(basic_istream<_CharT, _Traits>& __in,
     ^~~~~~~
/usr/include/c++/6/bits/basic_string.tcc:1509:5: note:   template argument deduction/substitution failed:
/in/foo.cc:14:15: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
  getline(cin,s);
               ^
/in/foo.cc:15:18: error: request for member 'length' in 's', which is of non-class type 'int'
  for(int i=0;i<s.length();i++)
                  ^~~~~~
/in/foo.cc:17:9: error: invalid types 'int[int]' for array subscript
   if(s[i]==' ') i++;
         ^
/in/foo.cc:18:3: error: 's1' was not declared in this scope
   s1=i;
   ^~
/in/foo.cc:19:10: error: request for member 'length' in 's', which is of non-class type 'int'
   if(i<s.length() && s[i]!=' ') i++;
          ^~~~~~
/in/foo.cc:19:25: error: invalid types 'int[int]' for array subscript
   if(i<s.length() && s[i]!=' ') i++;
                         ^
/in/foo.cc:20:3: error: 'ei' was not declared in this scope
   ei=i;
   ^~
/in/foo.cc:21:8: error: 'si' was not declared in this scope
   Dd(s,si,ei);
        ^~

信息

递交者
类型
递交
题目
P1010 3-4 颠倒单词
语言
C++
递交时间
2021-06-05 14:06:13
评测时间
2021-06-05 14:06:13
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes