记录详情

Compile Error

foo.cc:6:5: error: ‘Node’ does not name a type
    6 |     Node* head;
      |     ^~~~
foo.cc: In constructor ‘LinkList::LinkList()’:
foo.cc:10:18: error: class ‘LinkList’ does not have any field named ‘head’
   10 |     LinkList() : head(nullptr), Count(0) {}
      |                  ^~~~
foo.cc: In copy constructor ‘LinkList::LinkList(const LinkList&)’:
foo.cc:14:9: error: ‘head’ was not declared in this scope
   14 |         head = nullptr;
      |         ^~~~
foo.cc: In member function ‘LinkList& LinkList::operator=(const LinkList&)’:
foo.cc:22:13: error: ‘Node’ was not declared in this scope
   22 |             Node* temp = other.head;
      |             ^~~~
foo.cc:22:19: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   22 |             Node* temp = other.head;
      |                   ^~~~
      |                   tm
foo.cc:22:32: error: ‘const class LinkList’ has no member named ‘head’
   22 |             Node* temp = other.head;
      |                                ^~~~
foo.cc:23:19: error: ‘current’ was not declared in this scope
   23 |             Node* current = nullptr;
      |                   ^~~~~~~
foo.cc:26:23: error: ‘newNode’ was not declared in this scope
   26 |                 Node* newNode = new Node(temp->data);
      |                       ^~~~~~~
foo.cc:26:37: error: expected type-specifier before ‘Node’
   26 |                 Node* newNode = new Node(temp->data);
      |                                     ^~~~
foo.cc:27:22: error: ‘head’ was not declared in this scope
   27 |                 if (!head) {
      |                      ^~~~
foo.cc:38:21: error: cannot resolve overloaded function ‘prev’ based on conversion to type ‘bool’
   38 |             if (prev) {
      |                     ^
foo.cc:39:21: error: overloaded function with no contextual type information
   39 |                 prev->next = nullptr; // 确保新链表的最后一个节点的next指针为nullptr
      |                     ^~
foo.cc: In destructor ‘LinkList::~LinkList()’:
foo.cc:47:9: error: ‘Node’ was not declared in this scope
   47 |         Node* temp;
      |         ^~~~
foo.cc:47:15: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   47 |         Node* temp;
      |               ^~~~
      |               tm
foo.cc:48:16: error: ‘head’ was not declared in this scope
   48 |         while (head) {
      |                ^~~~
foo.cc:51:13: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
   51 |             delete temp;
      |             ^~~~~~~~~~~
foo.cc: In member function ‘int& LinkList::operator[](int)’:
foo.cc:60:9: error: ‘Node’ was not declared in this scope
   60 |         Node* temp = head;
      |         ^~~~
foo.cc:60:15: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   60 |         Node* temp = head;
      |               ^~~~
      |               tm
foo.cc:60:22: error: ‘head’ was not declared in this scope
   60 |         Node* temp = head;
      |                      ^~~~
foo.cc: In member function ‘void LinkList::Add(int)’:
foo.cc:69:9: error: ‘Node’ was not declared in this scope
   69 |         Node* newNode = new Node(value);
      |         ^~~~
foo.cc:69:15: error: ‘newNode’ was not declared in this scope
   69 |         Node* newNode = new Node(value);
      |               ^~~~~~~
foo.cc:69:29: error: expected type-specifier before ‘Node’
   69 |         Node* newNode = new Node(value);
      |                             ^~~~
foo.cc:70:14: error: ‘head’ was not declared in this scope
   70 |         if (!head) {
      |              ^~~~
foo.cc:73:19: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   73 |             Node* temp = head;
      |                   ^~~~
      |                   tm
foo.cc: At global scope:
foo.cc:87:1: error: ‘现在,我们可以使用main函数来测试这个链表类的功能:’ does not name a type
   87 | 现在,我们可以使用main函数来测试这个链表类的功能:
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

信息

递交者
类型
自测
题目
P1027 OO7-2 把链表对象包装成数组
语言
C++
递交时间
2024-04-06 15:15:23
评测时间
2024-04-06 15:15:23
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes