2010-03-07 13 views
10

Estoy tratando de implementar una lista enlazada, pero obtendrá un error al compilar:de error: '' no ha sido declarado

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

intSLList parece que ha sido declarado a mí, sin embargo, así que estoy realmente confundido.

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

Considere el uso de 'std :: list '. –

Respuesta

15

está utilizando una i minúscula

int intSLList::deleteFromHead(){ 
} 

debería ser

int IntSLList::deleteFromHead(){ 
} 

Nombres en C++ siempre entre mayúsculas y minúsculas.

12

intSLList no es lo mismo que IntSLList. Esto no es Pascal. C++ es sensible a mayúsculas y minúsculas

Cuestiones relacionadas