'showStructure' : is not a member of 'List<DataType>'

I keep getting this error but I don't know how to fix it. show5.cpp(37): error C2039: 'showStructure' : is not a member of 'List<DataType>'
Any help is appreciated thank you.

Here is the first code that seems to have the error
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
//--------------------------------------------------------------------
// show5.cpp: includes implementation of showStructure
//--------------------------------------------------------------------

#include "ListLinked.h"

template <typename DataType>
void List<DataType>::showStructure() const

// Outputs the items in a list. If the list is empty, outputs
// "Empty list". This operation is intended for testing and
// debugging purposes only.

{
    if ( isEmpty() )
    {
       cout << "Empty list" << endl;
    } 
    else
    {
	for (ListNode* temp = head; temp != 0; temp = temp->next) {
	    if (temp == cursor) {
		cout << "[";
	    }

	    // Assumes that dataItem can be printed via << because
	    // is is either primitive or operator<< is overloaded.
	    cout << temp->dataItem;	

	    if (temp == cursor) {
		cout << "]";
	    }
	    cout << " ";
	}
	cout << endl;
    }
}

Here is the second code that seems to be effected by it that I had to work on myself.
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
#include"ListLinked.h"

template <typename DataType>
List<DataType>::List(int ignored)  {
    head = NULL;     
    cursor = NULL;                       
}


template <typename DataType>
List<DataType>::List(const List& other)  {
    ListNode* copy = other.head;
    
    while (copy != NULL)  {
       this->dataItem = copy->dataItem;
       this->next = copy->next;
       gotoNext();
       copy = copy->next;
    }
    *this = other;                        
}


template <typename DataType>
List<DataType>& List<DataType>::operator=(const List& other)  {
    ListNode* copy = other.head;
    while (copy != NULL)  {
          insert(copy->dataItem);
          gotoNext();
          copy = copy->next;
    }
    return *this;
}

template <typename DataType>
List<DataType>::~List()  {
    ListNode* trash;
    ListNode* step = head;
    while (step != NULL)  {
          trash = step;
          step = step->next;
          delete trash;
    }
    head = NULL;
}

template <typename DataType>			//fixed problem with adding between nodes
void List<DataType>::insert(const DataType& newDataItem) throw (logic_error)  {
     if (!isEmpty())  {
        ListNode* tempNode = cursor;
        cursor = new ListNode(newDataItem, tempNode->next);
        tempNode->next = cursor;
     }
     else if (isEmpty())  {
          head = new ListNode(newDataItem, 0);
          cursor = head;
          
     }
}


template <typename DataType>
void List<DataType>::remove() throw (logic_error)  {
     ListNode* lostNode;
     if (isEmpty())  {
        cout << "Cannot remove from empty list." << endl;
     
#include "show5.cpp" 

Thank you in advance.
Last edited on
Ew, dat #include "show5.cpp" . I'm not sure if its the problem, but its been a long time since I saw someone include a .cpp file...
Topic archived. No new replies allowed.