记录详情

Compile Error

foo.cc: In function ‘int main()’:
foo.cc:14:8: error: no match for ‘operator<<’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘int’)
   14 |     cin<<k1<<k2;
      |     ~~~^~~~
      |     |    |
      |     |    int
      |     std::istream {aka std::basic_istream<char>}
foo.cc:14:8: note: candidate: ‘operator<<(int, int)’ (built-in)
   14 |     cin<<k1<<k2;
      |     ~~~^~~~
foo.cc:14:8: note:   no known conversion for argument 1 from ‘std::istream’ {aka ‘std::basic_istream<char>’} to ‘int’
In file included from /nix/gcc-13.3.0/include/c++/13.3.0/string:54,
                 from /nix/gcc-13.3.0/include/c++/13.3.0/bits/locale_classes.h:40,
                 from /nix/gcc-13.3.0/include/c++/13.3.0/bits/ios_base.h:41,
                 from /nix/gcc-13.3.0/include/c++/13.3.0/ios:44,
                 from /nix/gcc-13.3.0/include/c++/13.3.0/ostream:40,
                 from iostream:41:
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_string.h:4032:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
 4032 |     operator<<(basic_ostream<_CharT, _Traits>& __os,
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/bits/basic_string.h:4032:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
In file included from /nix/gcc-13.3.0/include/c++/13.3.0/bits/ios_base.h:46:
/nix/gcc-13.3.0/include/c++/13.3.0/system_error:339:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)’
  339 |     operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/system_error:339:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:554:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)’
  554 |     operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:554:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:564:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)’
  564 |     operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:564:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:570:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)’
  570 |     operator<<(basic_ostream<char, _Traits>& __out, char __c)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:570:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:581:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)’
  581 |     operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:581:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:586:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)’
  586 |     operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:586:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:645:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)’
  645 |     operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:645:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
In file included from /nix/gcc-13.3.0/include/c++/13.3.0/ostream:880:
/nix/gcc-13.3.0/include/c++/13.3.0/bits/ostream.tcc:307:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)’
  307 |     operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/bits/ostream.tcc:307:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:662:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)’
  662 |     operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:662:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:675:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)’
  675 |     operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:675:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:680:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)’
  680 |     operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:680:5: note:   template argument deduction/substitution failed:
foo.cc:14:10: note:   ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’
   14 |     cin<<k1<<k2;
      |          ^~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:801:5: note: candidate: ‘template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)’
  801 |     operator<<(_Ostream&& __os, const _Tp& __x)
      |     ^~~~~~~~
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:801:5: note:   template argument deduction/substitution failed:
/nix/gcc-13.3.0/include/c++/13.3.0/ostream: In substitution of ‘template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]’:
foo.cc:14:10:   required from here
/nix/gcc-13.3.0/include/c++/13.3.0/ostream:801:5: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
foo.cc:15:10: warning: statement has no effect [-Wunused-value]
   15 |     for (k1; k1<=k2; k1++)
      |          ^~

信息

递交者
类型
自测
题目
1-2 斐波那契数列的和
语言
C++
递交时间
2024-08-20 03:23:21
评测时间
2024-08-20 03:23:21
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes