加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – error:”尚未声明

发布时间:2020-12-16 07:49:50 所属栏目:百科 来源:网络整理
导读:我正在尝试实现链接列表,但在编译时会收到错误: intSLLst.cpp:38: error: ‘intSLList’ has not been declared intSLList看起来像已经被声明给我,所以我真的很困惑. intSLLst.cpp #include iostream#include "intSLLst.h"int intSLList::deleteFromHead(){
我正在尝试实现链接列表,但在编译时会收到错误:

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

解决方法

你在使用小写字母我
int intSLList::deleteFromHead(){
}

应该

int IntSLList::deleteFromHead(){
}

c中的名称总是区分大小写.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读