2016-01-29 112 views
-2

我得到的錯誤沒有這樣的文件或目錄存在,它是混亂地獄我。我不想幫助填補我的方法或任何事情,我想爲自己做。我想修復這個錯誤,以便我可以開始使用我的項目。沒有這樣的文件或目錄存在

這是我的錯誤: My Error

這裏是我的代碼,其中的錯誤發生。如果您需要其他任何東西,我會很樂意更新我的問題,或提供相關信息。由於任何人誰幫助

#ifndef _DLINKEDLIST_H_ 
#define _DLINKEDLIST_H_ 

#include <cstdlib> 
#include <stdexcept> 
#include <string> 

using namespace std; 

// template class for doubly-linked list node 
template <class T> 
class Node 
{ 
    public: 
    T data; 
    //string data; 
    Node<T>* prev; 
    Node<T>* next; 

    // default constructor 
    //template <class T> 
    Node(T value) 
    { 
     data = value; 
     prev = NULL; 
     next = NULL; 
    } 
}; 

// DLinkedList class definition 
template <class T> 
class DLinkedList 
{ 
    private: 
    // DLinkedList private members 
    int size; // number of items stored in list 
    Node<T>* front; // references to the front 
    Node<T>* back; // and back of the list 

    // helper function for deep copy 
    // Used by copy constructor and operator= 
    void CopyList(const DLinkedList& ll); 

    // helper function for deep delete 
    // Used by destructor and copy/assignment 
    void DeleteList(); 

    public: 
    // default constructor 
    DLinkedList(); 

    // copy constructor, performs deep copy of list elements 
    DLinkedList(const DLinkedList& ll); 

    // destructor 
    ~DLinkedList(); 

    // MUTATORS 

    // Inserts an item at the front of the list 
    // POST: List contains item at position 0 
    // PARAM: item = item to be inserted 
    void InsertFront(T item); 

    // Inserts an item at the back of the list 
    // POST: List contains item at back 
    // PARAM: item = item to be inserted 
    void InsertBack(T item); 

    // Inserts an item in position p (0-indexed) 
    // Throws exception for invalid index 
    // PRE: 0 <= p <= size 
    // POST: List contains item at position p 
    // PARAM: item = item to be inserted, p = position where item will be inserted 
    void InsertAt(T item, int p); 

    // Removes and returns an item from position p (0-indexed) 
    // Throws exception if list is empty or index invalid 
    // PRE: 0 <= p < size 
    // POST: Item is removed from list 
    // PARAM: p = position from where item will be removed 
    T RemoveAt(int p); 

    // Removes duplicates from the list, preserving existing order of remaining items. 
    // The first occurrence of any duplicate (relative to the front of the list) 
    // is the one which remains. 
    // We have not yet learned about efficiency so you may implement this in any way 
    // as long as the resulting list satisfies the requirement above. 
    // PRE: 
    // POST: List contains no duplicates, front and back point to the appropriate nodes 
    // PARAM: 
    void RemoveDuplicates(); 

    // ACCESSORS 

    // Returns size of list 
    int Size() const; 

    // Returns whether the list is empty 
    bool IsEmpty() const; 

    // Returns existence of item 
    bool Contains(T item) const; 

    // Returns item at index (0-indexed) 
    // Throws exception for invalid index 
    T ElementAt(int p) const; 

    // OVERLOADED OPERATORS 

    // overloaded assignment operator 
    // must work in the following cases: 
    // list2 = list1 -> general case 
    // list2 = list2 -> should do nothing 
    DLinkedList& operator=(const DLinkedList& ll); 
}; 

#include "dlinkedlist.cpp" 

#endif 
+0

我明白這是dlinkedlist.h的代碼。你還創建了一個名爲dlinkedlist.cpp的文件嗎? –

+0

「dlinkedlist.cpp」確實存在,對吧?它和頭文件在同一個目錄下? – AndyG

+0

@KenWhite是的。我也必須掃描所有標題才能找到包含在最後的:( –

回答

0

答案是一個快速簡便的#include "..\srcdlinkedlist.cpp"

,而不是#include "dlinkedlist.cpp"

相關問題