记录详情

Compile Error

foo.cc: In constructor ‘Node::Node()’:
foo.cc:10:17: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
   10 |                 cout << "Node()" << endl;
      |                 ^~~~
      |                 std::cout
iostream:63:18: note: ‘std::cout’ declared here
foo.cc:10:37: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’?
   10 |                 cout << "Node()" << endl;
      |                                     ^~~~
      |                                     std::endl
In file included from iostream:41:
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:735:5: note: ‘std::endl’ declared here
  735 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
foo.cc: In constructor ‘Node::Node(int)’:
foo.cc:14:17: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
   14 |                 cout << "Node()" << data << endl;
      |                 ^~~~
      |                 std::cout
iostream:63:18: note: ‘std::cout’ declared here
foo.cc:14:45: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’?
   14 |                 cout << "Node()" << data << endl;
      |                                             ^~~~
      |                                             std::endl
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:735:5: note: ‘std::endl’ declared here
  735 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
foo.cc: In destructor ‘Node::~Node()’:
foo.cc:19:17: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
   19 |                 cout << "~Node()" << t << endl;
      |                 ^~~~
      |                 std::cout
iostream:63:18: note: ‘std::cout’ declared here
foo.cc:19:43: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’?
   19 |                 cout << "~Node()" << t << endl;
      |                                           ^~~~
      |                                           std::endl
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:735:5: note: ‘std::endl’ declared here
  735 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
foo.cc: In member function ‘void Node::Output()’:
foo.cc:30:17: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
   30 |                 cout << i->data << " ";
      |                 ^~~~
      |                 std::cout
iostream:63:18: note: ‘std::cout’ declared here
foo.cc:31:9: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
   31 |         cout << endl;
      |         ^~~~
      |         std::cout
iostream:63:18: note: ‘std::cout’ declared here
foo.cc:31:17: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’?
   31 |         cout << endl;
      |                 ^~~~
      |                 std::endl
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:735:5: note: ‘std::endl’ declared here
  735 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
foo.cc: At global scope:
foo.cc:131:16: error: ‘ostream’ does not name a type
  131 |         friend ostream & operator<<(ostream &out, IntLinkList &l)
      |                ^~~~~~~
foo.cc: In constructor ‘IntLinkList::IntLinkList()’:
foo.cc:58:17: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
   58 |                 cout << "LinkList()" << endl;
      |                 ^~~~
      |                 std::cout
iostream:63:18: note: ‘std::cout’ declared here
foo.cc:58:41: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’?
   58 |                 cout << "LinkList()" << endl;
      |                                         ^~~~
      |                                         std::endl
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:735:5: note: ‘std::endl’ declared here
  735 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
foo.cc: In constructor ‘IntLinkList::IntLinkList(char*)’:
foo.cc:62:17: error: ‘ifstream’ was not declared in this scope; did you mean ‘std::ifstream’?
   62 |                 ifstream fin(fname);
      |                 ^~~~~~~~
      |                 std::ifstream
In file included 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:
/nix/gcc-13.2.0/include/c++/13.2.0/iosfwd:164:41: note: ‘std::ifstream’ declared here
  164 |   typedef basic_ifstream<char>          ifstream;
      |                                         ^~~~~~~~
foo.cc:63:21: error: ‘fin’ was not declared in this scope
   63 |                 if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
      |                     ^~~
foo.cc:63:34: error: ‘cerr’ was not declared in this scope; did you mean ‘std::cerr’?
   63 |                 if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
      |                                  ^~~~
      |                                  std::cerr
iostream:64:18: note: ‘std::cerr’ declared here
foo.cc:63:95: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’?
   63 |                 if (fin == NULL) cerr << "IntLinkList(char *fname): cannot open:" << fname << endl;
      |                                                                                               ^~~~
      |                                                                                               std::endl
/nix/gcc-13.2.0/include/c++/13.2.0/ostream:735:5: note: ‘std::endl’ declared here
  735 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
foo.cc:65:23: error: ‘fin’ was not declared in this scope
   65 |                 while(fin >> data)
      |                       ^~~
foo.cc: In copy constructor ‘IntLinkList::IntLinkList(IntLinkList&)’:
foo.cc:75:26: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   75 |                 }while(i = i->next);
      |                        ~~^~~~~~~~~
foo.cc: In member function ‘void IntLinkList::Append(int)’:
foo.cc:105:17: error: ‘i’ was not declared in this scope
  105 |                 i->next = ntail;
      |                 ^
foo.cc: In member function ‘void IntLinkList::InsertAt(int, int)’:
foo.cc:119:39: error: ‘i’ was not declared in this scope
  119 |                         nnode->next = i;
      |                                       ^
foo.cc:123:21: error: ‘i’ was not declared in this scope
  123 |                 if (i->next == NULL)//如果要插入尾结点
      |                     ^
foo.cc:128:31: error: ‘i’ was not declared in this scope
  128 |                 nnode->next = i->next;//链接插入的结点和k号结点
      |                               ^
foo.cc: In function ‘int main(int, char**)’:
foo.cc:143:9: error: ‘cin’ was not declared in this scope; did you mean ‘std::cin’?
  143 |         cin >> n;
      |         ^~~
      |         std::cin
iostream:62:18: note: ‘std::cin’ declared here
foo.cc:148:14: error: ‘i’ was not declared in this scope
  148 |         for (i = 0; i < n; i++)
      |              ^
foo.cc:150:9: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
  150 |         cout << l;
      |         ^~~~
      |         std::cout
iostream:63:18: note: ‘std::cout’ declared here

信息

递交者
类型
自测
题目
P1026 OO7-1 链表类的构造、析构
语言
C++
递交时间
2024-04-07 00:36:15
评测时间
2024-04-07 00:36:15
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes