c++ - 错误 : '' has not been declared

标签 c++ compiler-errors

我正在尝试实现链表,但在编译时出现错误:

intSLLst.cpp:38: error: ‘intSLList’ has not been declared

intSLList 看起来好像已经向我声明了,所以我真的很困惑。

intSLLst.cpp

#include <iostream>
#include "intSLLst.h"


int intSLList::deleteFromHead(){
}

int main(){

}

intSLLst.h

#ifndef INT_LINKED_LIST
#define INT_LINKED_LIST
#include <cstddef>

class IntSLLNode{
  int info;
  IntSLLNode *next;

  IntSLLNode(int el, IntSLLNode *ptr = NULL){
    info = el; next = ptr;
  }

};

class IntSLList{
 public:
  IntSLList(){
    head = tail = NULL;
  }

  ~IntSLList();

  int isEmpty();
  bool isInList(int) const;

  void addToHead(int);
  void addToTail(int);

  int deleteFromHead();
  int deleteFromTail();
  void deleteNode(int);

 private:
  IntSLLNode *head, *tail;

};

#endif

最佳答案

你使用的是小写的 i

int intSLList::deleteFromHead(){
}

应该是

int IntSLList::deleteFromHead(){
}

C++ 中的名称始终区分大小写。

关于c++ - 错误 : '' has not been declared,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2397309/

相关文章:

c++ - "map/set iterators incompatible" map 销毁,取决于构造函数调用

c# - 包装 C++ 以便在 C# 中使用

c++ - 可能违反严格的别名?

c++ - Visual C++ Express 2010 突然不接受#includes

c++ - 无法在 std::map 成员变量中分配具有前向声明值的类

斯卡拉错误 : "forward reference extends over definition of value" when code appears in a function

c++ - 计算重复项并将这些计数器存储在数组 C++ 中

c++ - 寻找使用 GCC >= 4.9.2 运行 Linux 的大端硬件

c++ - 断言失败时析构函数中的 CPPUNIT_ASSERT_MESSAGE 崩溃

compiler-errors - 关于书中示例的错误