2010-03-07 91 views
10

我試圖編譯何時實現鏈表,但得到一個錯誤:錯誤:「」還沒有被宣佈

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 
+1

考慮使用'std :: list '。 – 2010-03-07 18:19:46

回答

15

您使用的是較低的情況下,我

int intSLList::deleteFromHead(){ 
} 

應該

int IntSLList::deleteFromHead(){ 
} 

名稱在C++中始終區分大小寫。

12

intSLList是不一樣的IntSLList。這不是帕斯卡。 C++區分大小寫。