foo.cc: In constructor ‘IntLinkList::IntLinkList(char*)’:
foo.cc:66:25: error: no match for ‘operator==’ (operand types are ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} and ‘long int’)
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^
foo.cc:66:25: note: candidate: ‘operator==(int, long int)’ (built-in)
foo.cc:66:25: note: no known conversion for argument 1 from ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} to ‘int’
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/iosfwd:42,
from /nix/gcc-13.2.0/include/c++/13.2.0/ios:40,
from /nix/gcc-13.2.0/include/c++/13.2.0/ostream:40,
from iostream:41:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/postypes.h:192:5: note: candidate: ‘template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)’
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
In file included from /nix/glibc-2.38-44-dev/include/stdio.h:33,
from /nix/gcc-13.2.0/include/c++/13.2.0/cstdio:42,
from /nix/gcc-13.2.0/include/c++/13.2.0/ext/string_conversions.h:45,
from /nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:4097,
from /nix/gcc-13.2.0/include/c++/13.2.0/string:54,
from /nix/gcc-13.2.0/include/c++/13.2.0/bits/locale_classes.h:40,
from /nix/gcc-13.2.0/include/c++/13.2.0/bits/ios_base.h:41,
from /nix/gcc-13.2.0/include/c++/13.2.0/ios:44:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::fpos<_StateT>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/string:43:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/allocator.h:237:5: note: candidate: ‘template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)’
237 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/allocator.h:237:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::allocator<_CharT>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/string:48:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_iterator.h:448:5: note: candidate: ‘template<class _Iterator> bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)’
448 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::reverse_iterator<_Iterator>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_iterator.h:493:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)’
493 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::reverse_iterator<_Iterator>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_iterator.h:1678:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’
1678 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_iterator.h:1678:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::move_iterator<_IteratorL>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_iterator.h:1748:5: note: candidate: ‘template<class _Iterator> bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)’
1748 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_iterator.h:1748:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::move_iterator<_IteratorL>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:64,
from /nix/gcc-13.2.0/include/c++/13.2.0/string:51:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_pair.h:812:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’
812 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_pair.h:812:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::pair<_T1, _T2>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:3698:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
3698 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:3698:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:3715:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’
3715 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:3715:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:3762:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
3762 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_string.h:3762:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: mismatched types ‘const _CharT*’ and ‘std::basic_ifstream<char>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/bits/locale_facets.h:48,
from /nix/gcc-13.2.0/include/c++/13.2.0/bits/basic_ios.h:37,
from /nix/gcc-13.2.0/include/c++/13.2.0/ios:46:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/streambuf_iterator.h:234:5: note: candidate: ‘template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)’
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed:
foo.cc:66:28: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::istreambuf_iterator<_CharT, _Traits>’
66 | if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
| ^~~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/bits/ios_base.h:46:
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:449:3: note: candidate: ‘bool std::operator==(const error_code&, const error_code&)’
449 | operator==(const error_code& __lhs, const error_code& __rhs) noexcept
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:449:32: note: no known conversion for argument 1 from ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} to ‘const std::error_code&’
449 | operator==(const error_code& __lhs, const error_code& __rhs) noexcept
| ~~~~~~~~~~~~~~~~~~^~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:465:3: note: candidate: ‘bool std::operator==(const error_code&, const error_condition&)’
465 | operator==(const error_code& __lhs, const error_condition& __rhs) noexcept
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:465:32: note: no known conversion for argument 1 from ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} to ‘const std::error_code&’
465 | operator==(const error_code& __lhs, const error_condition& __rhs) noexcept
| ~~~~~~~~~~~~~~~~~~^~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:480:3: note: candidate: ‘bool std::operator==(const error_condition&, const error_condition&)’
480 | operator==(const error_condition& __lhs,
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:480:37: note: no known conversion for argument 1 from ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} to ‘const std::error_condition&’
480 | operator==(const error_condition& __lhs,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:517:3: note: candidate: ‘bool std::operator==(const error_condition&, const error_code&)’
517 | operator==(const error_condition& __lhs, const error_code& __rhs) noexcept
| ^~~~~~~~
/nix/gcc-13.2.0/include/c++/13.2.0/system_error:517:37: note: no known conversion for argument 1 from ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} to ‘const std::error_condition&’
517 | operator==(const error_condition& __lhs, const error_code& __rhs) noexcept
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
foo.cc: In copy constructor ‘IntLinkList::IntLinkList(IntLinkList&)’:
foo.cc:78:26: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
78 | }while(i = i->next);
| ~~^~~~~~~~~
foo.cc: In member function ‘void IntLinkList::Append(int)’:
foo.cc:108:17: error: ‘i’ was not declared in this scope
108 | i->next = ntail;
| ^
foo.cc: In member function ‘void IntLinkList::InsertAt(int, int)’:
foo.cc:122:39: error: ‘i’ was not declared in this scope
122 | nnode->next = i;
| ^
foo.cc:126:21: error: ‘i’ was not declared in this scope
126 | if (i->next == NULL)//如果要插入尾结点
| ^
foo.cc:131:31: error: ‘i’ was not declared in this scope
131 | nnode->next = i->next;//链接插入的结点和k号结点
| ^
foo.cc: In function ‘int main(int, char**)’:
foo.cc:151:14: error: ‘i’ was not declared in this scope
151 | for (i = 0; i < n; i++)
| ^