记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:5:17: error: no matching function for call to 'getline(std::istream&, char [3])'
  getline(cin,num);
                 ^
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:5:17: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char [3]'
  getline(cin,num);
                 ^
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:5:17: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char [3]'
  getline(cin,num);
                 ^
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:5:17: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char [3]'
  getline(cin,num);
                 ^
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:5:17: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char [3]'
  getline(cin,num);
                 ^

信息

递交者
类型
递交
题目
反序数字
语言
C++
递交时间
2024-04-28 19:30:47
评测时间
2024-04-28 19:30:47
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes