Help with errors...

I am getting this when I try to compile. Will post below.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef INT_LINKED_LIST
#define INT_LINKED_LIST
class IntSLLNode {
public:
    IntSLLNode() {
        next = 0;
    }
    IntSLLNode(int el, IntSLLNode *ptr = 0) {
        info = el; next = ptr;
    }
    int info;
    IntSLLNode *next;
};
class IntSLList {
public:
    IntSLList() {
        head = tail = 0;
    }
    ~IntSLList();
    int isEmpty() {
        return head == 0;
    }
    void addToHead(int);
    void addToTail(int);
    int  deleteFromHead(); // delete the head and return its info;
    int  deleteFromTail(); // delete the tail and return its info;
    void deleteNode(int);
    bool isInList(int) const;
private:
    IntSLLNode *head, *tail;
};
#endif
//************************  intSLList.cpp **************************
#include <iostream.h>
#include "intSLList.h"
IntSLList::~IntSLList() {
    for (IntSLLNode *p; !isEmpty(); ) {
        p = head->next;
        delete head;
        head = p;
    }
}
void IntSLList::addToHead(int el) {
    head = new IntSLLNode(el,head);
    if (tail == 0)
       tail = head;
}
void IntSLList::addToTail(int el) {
    if (tail != 0) {    // if list not empty;
         tail->next = new IntSLLNode(el);
         tail = tail->next;
    }
    else head = tail = new IntSLLNode(el);
}
int IntSLList::deleteFromHead() {
    int el = head->info;
    IntSLLNode *tmp = head;
    if (head == tail)   // if only one node in the list;
         head = tail = 0;
    else head = head->next;
    delete tmp;
    return el;
}
int IntSLList::deleteFromTail() {
    int el = tail->info;
    if (head == tail) { // if only one node in the list;
 delete head;
         head = tail = 0;
    }
    else {              // if more than one node in the list,
         IntSLLNode *tmp;  // find the predecessor of tail;
         for (tmp = head; tmp->next != tail; tmp = tmp->next);
         delete tail;
         tail = tmp;    // the predecessor of tail becomes tail;
         tail->next = 0;
    }
    return el;
}
void IntSLList::deleteNode(int el) {
    if (head != 0)                     // if nonempty list;
         if (head == tail && el == head->info) { // if only one
              delete head;                       // node in the list;
              head = tail = 0;
         }
         else if (el == head->info) {// if more than one node in the list
              IntSLLNode *tmp = head;
              head = head->next;
              delete tmp;            // and old head is deleted;
         }
         else {                      // if more than one node in the list
              IntSLLNode *pred, *tmp;
              for (pred = head, tmp = head->next; // and a nonhead node
                   tmp != 0 && !(tmp->info == el);// is deleted;
                   pred = pred->next, tmp = tmp->next);
              if (tmp != 0) {
                   pred->next = tmp->next;
                   if (tmp == tail)
                      tail = pred;
                   delete tmp;
              }
         }
}
void showList( ) {IntSLLNode *p; // p is a temporary pointer to Node object 
     if (head = = 0) 
        cout << "No Node in the list" << endl; 
     else { 
          for (p = head; p->next != 0; p = p->next) 
              cout << p->info << " "; 
              cout << p->info << endl; 
              } 
          }
bool IntSLList::isInList(int el) const {
    IntSLLNode *tmp;
    for (tmp = head; tmp != 0 && !(tmp->info == el); tmp = tmp->next);
    return tmp != 0;
}

int main()
    DLList<int> oList;    // create an empty list object
    oList.showList();
    
    oList.addToDLLTail(5);
    oList.addToDLLTail(8);
    oList.addToDLLTail(3);
    oList.showList();
    
    oList.addToDLLHead(6); 
    oList.addToDLLHead(13);
    oList.addToDLLHead(9);
    oList.showList();
    
    oList.deleteFromDLLHead(); 
    oList.showList();
    
    oList.deleteFromDLLTail();
    oList.showList();
    
    oList.deleteDLLNode(5); 
    oList.showList();

   system("PAUSE");
   return EXIT_SUCCESS;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Compiler: Default compiler
Executing  g++.exe...
g++.exe "C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp" -o "C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.exe"   -g3  -I"lib\gcc\mingw32\3.4.2\include"  -I"include\c++\3.4.2\backward"  -I"include\c++\3.4.2\mingw32"  -I"include\c++\3.4.2"  -I"include"   -L"lib" -g3 
In file included from C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/backward/iostream.h:31,
                 from C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:34:
C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:35:23: intSLList.h: No such file or directory
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp: In function `void showList()':
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:104: error: `head' undeclared (first use this function)
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:104: error: (Each undeclared identifier is reported only once for each function it appears in.)

C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:104: error: expected primary-expression before '=' token

C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp: At global scope:

C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:119: error: expected init-declarator before "DLList"
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:119: error: expected `,' or `;' before "DLList"
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:120: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:120: error: expected `,' or `;' before '.' token

C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:122: error: expected constructor, destructor, or type conversion before '.' token

C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:122: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:123: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:123: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:124: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:124: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:125: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:125: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:127: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:127: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:128: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:128: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:129: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:129: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:130: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:130: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:132: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:132: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:133: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:133: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:135: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:135: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:136: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:136: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:138: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:138: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:139: error: expected constructor, destructor, or type conversion before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:139: error: expected `,' or `;' before '.' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:141: error: expected constructor, destructor, or type conversion before '(' token
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:141: error: expected `,' or `;' before '(' token

C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:142: error: expected unqualified-id before "return"
C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:142: error: expected `,' or `;' before "return"

C:\Documents and Settings\Larry's Small Engine\My Documents\Downloads\5a.cpp:143: error: expected declaration before '}' token

Execution terminated
No problem! I can help you with errors! How many errors do you need?:)
First of all the compiler did not find header "intSLList.h" So all other errors in fact are the result of this error.
Also the compiler warns you that instead of header <iostream.h> you should use header <iostream>
Topic archived. No new replies allowed.