This is the error I am getting. Can anybody help with this??? Code to follow error line.
G:\Makefile.win
[Build Error] No rule to make target `all'. Stop.
Code:// File: ListType.h Class and type definitions for the C++ dynamic // memory allocation imlementationof ADT list #ifndef LISTDO_H #define LISTDO_H #endif #include "el_t.h" typedef struct node_t* pointer_t; struct node_t { el_t el; pointer_t next; }; class list { public: // List constructor and destructor list(void); ~list(void); //Methods that manipulate list nodes void StoreInfo(el_t); el_t RetrieveInfo(void); el_t RetrieveNextInfo(void); //Methods that manipulate the list void Insert(el_t); void InsertAfter(el_t); void Delete(void); //Methods that test for certain conditions bool AtFirst(void); bool AtEnd(void); bool ListIsEmpty(void); bool ListIsFull(void); bool CurIsEmpty(void); protected: pointer_t head; //pointer to head node pointer_t cur; //pointer to current node pointer_t prev; //pointer to previous node pointer_t MakeNode(el_t); void DestroyNode(pointer_t); void NodeReferenceError(void); }; // File: ListTypeImp.cpp Contents: C++ source code for dynamic memeory // allocation implementations of ADT list #include<iostream.h> #include<stdlib.h> #include "ListType.h" using namespace std; // Default constructor; initializes a list to empty //Pre:none //Post: The head, current, and previous pointers are empty list::list(void) { head = NULL; cur = NULL; prev = NULL; } // List destructor function //Pre: The lis thas gone out of scope or an explicit call // to the list destructor has occurred. //Post:All the nodes of this list have been destoryed. list::~list(void) { ToFirst(); while(!ListIsEmpty()) Delete(): } // Boolean function to return TRUE if the list is empty // Pre: The list has been intialized //Post: The function has returned TRUE if the list is empty, // FALSE otherwise. bool list::ListIsEmpty(void) { return (head == NULL ? true : false); } // Boolean function to return TRUE if list is full //Pre: The list has been intialized //Post: The function has returned FALSE because, within the // bounds of memory size, the list never fills. bool list::ListIsFull(void) { return false; } // Boolean function to return TRUE if the current postion is // empty //Pre: The list has been intialized //Post: The function return TRUE if there is no current node, // FALSE otherwise list::CurIsEmpty(void) { return ( cur == NULL true : false); } // Function to set the curr3ent node to the head node // Pre: The list has been intialized //Post: cur has the value of head (NULL of address of first node) void list::ToFirst(void) { cur = head; prev = NULL; } // Function to return TRUE if the current position is at head // node or the list is empty //Pre: cur is NULL or a reference node. //Post: The function returned TRUE if cur has the same value as head // (NULL or address of first node); FALSE otherwise bool list::AtFirst(void) { return (head == cur ? true : false); } // Boolean function to return TRUE if the current node is the last in // the list or the list is empty //Pre: The list has been intialized //Post: The funtion has returned TRUE if the current node is the last // node or the lsit is empty; FALSE otherwise bool list::AtEnd(void) { bool rc; //return code if ListIsEmpty()) rc = true; else if (CurisEmpty()) rc = false; else rc = (cur -> next == NULL ? true : false ); return (rc); } //Function to make a nonempty current position indicate the nest //node in the list //Pre: The list has an nonempty current position //Post: cur points to the next node ir os NULL incase cur intitially // pointed to the last node. If the current positionwas NULL // initally, errorhandling routine NOdeReferenceError was called. void list::Advance(void) { if (curIsEmpty()) NodeReferenceError(); else { prev = cur; cur = cur -> next; } } // Funtion to insert new node adfter the current node //Pre: The list is empty or there is a current node. e is the // value for the node to be inserted. //Post: The list has a new node with e's value. If the list was // empty initially, this is the only node. If not, the new node // is after the current node. If the list was not empty but the current // position was, then NodeRefernceError was called. void list::InsertAfter(el_t e) { pointer_t target = MakeNode(e); if (ListIsEmpty()) // create one-element list { head = target; cur = target; prev = NULL; } else if (CurIsEmpty()) //empty cur, nonempty list NodeRefernnceError(); else // insert after current node { target -> next = cur -> next; cur -> next = target; } } // Function to insert a node before the current node and make the new // node the current node //Pre: The list is empty or there is a current node. e is the value // for the node to be inserted //Post: The lsit has a new node with e's value. If the list was // empty initially, this is the only node. If not, the new // node is before the former current node. The new node is // now the current node. If the list was not empty but the // current position was, then NodeRefernceError was called. void list::Insert(el_t e) { pointer_t target = MakeNode(e); if (ListIsEmpty()) // create one-element list { head = target; cur = target; prev = NULL; } else if (CurIsEmpty()) // empty cur, nonempty list NodeRefernceError(); else if (atFirst()) //new head node { target -> next = cur; head = target; cur = target; } else // insert between 2 nodes { target -> next = cur; prev->next = target; cur = target; } } // Function to delete the current node of the list //Pre: The list is nonempty with a nonempty current position. //Post: The list has been revised so that the former current // node has been deleted and its successor has become the new // current node. void list::Delete(void) { pointer_t tmp; if(curIsEmpty()) //empty list of cur NodeRefernceError(); else if (AtFirst()) //delete head node { tmp = cur; cur = cur -> next; head = cur; DestroyNode(tmp); } else { tmp = cur; cur = cur-> next; prev->next = cur; DestroyNode(tmp); } } // Function to store a value in the information field of the // current node //Pre: There is a current node, and e is the type el_t //Post: The information field of the current node has e's value // If there is no such node, NodeREfernceError was called void list::StoreInfo(el_t e) { if (CurIsEmpty()) NodeRefernceError(); else cur->el = e; } // Function to return the information portion fo the current node //Pre: There is no current node //Post: The function returns information field of the current node. // If there is no such node, NodeRefernceError ws called. el_t list::RetrieveInfo(void) { if (CurIsEmpty()) NodeRefernceError(); retrun (cur->el); } //Function to return the value from the information field of node // after the current node // Pre: There is a current node that is not the last node //Post: The informnation field of the node after current node has // been returned. If there is no such node, NodeRefernceError // was called. el_t list::RetreiveNextInfo(void) { if (CurIsEmpty() || AtEnd()) NodeRefernceError(); return ((cur->next)->el); } //Function to place information into a new node and return a //pointer to that node. //Pre: e is an item of type el_t. //Post: The function has returned a pointer (type pointer_t) // to a node that contains an information portion with value // e and a link portion with value NULL. If allocation failed // the program aborted. pointer_t list::MakeNode(el_t e) { pointer_t p = new node_t; if(!p) { cerr <<"Error making node\n"; exit(1); } else { p->el = e; p->next = NULL; } return p; } //Function to destroy a list node //Pre: p points to a node //Post: The node has been freed. void list::DestroyNode(pointer_t p) { delete p; } //Error procedure for no current node or an improper node //Pre: A node reference error condition exists. //Post: An error message has been printed and the program aborted void list::NodeRefernceError(void) { cerr<< "Error: No current node or an improper node\n"; exit(1); } #include <iostream> #include <ctdlib> #include "ListType.h" #include <fstream> int main { /*truct el_t { int int_field; char char_field; link not sure that this belongs yet */ list L; el_t e; system("PAUSE"); return 0; }



LinkBack URL
About LinkBacks


