I am getting this error when compiling my program:
Compiling C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp...
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\orderedLinkedListType.h:13: error: expected template-name before '<' token
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\orderedLinkedListType.h:13: error: expected `{' before '<' token
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\orderedLinkedListType.h:13: error: expected unqualified-id before '<' token
[Warning] C:\Dev-Cpp\Chapter5\Today\LlistType\orderedLinkedListType.h:21:7: warning: no newline at end of file
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp:8: error: aggregate `orderedLinkedListType<int> list1' has incomplete type and cannot be defined
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp:8: error: aggregate `orderedLinkedListType<int> list2' has incomplete type and cannot be defined
Complete Compile C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp: 5 error(s), 3 warning(s)
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
|
Compiling C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp...
[Warning] C:\Dev-Cpp\Chapter5\Today\LlistType\linkedList.h:103:7: warning: no newline at end of file
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\orderedLinkedListType.h:13: error: expected template-name before '<' token
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\orderedLinkedListType.h:13: error: expected `{' before '<' token
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\orderedLinkedListType.h:13: error: expected unqualified-id before '<' token
[Warning] C:\Dev-Cpp\Chapter5\Today\LlistType\orderedLinkedListType.h:21:7: warning: no newline at end of file
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp:8: error: aggregate `orderedLinkedListType<int> list1' has incomplete type and cannot be defined
[Error] C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp:8: error: aggregate `orderedLinkedListType<int> list2' has incomplete type and cannot be defined
[Warning] C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp:39:2: warning: no newline at end of file
Complete Compile C:\Dev-Cpp\Chapter5\Today\LlistType\main.cpp: 5 error(s), 3 warning(s)
[code]
//Ordered linked list derived from general linked list
//Header File: orderedLinkedList.h
#ifndef ORDEREDLINKEDLISTTYPE_H
#define ORDEREDLINKEDLISTTYPE_H
#include<iostream>
#include<cassert>
#include "linkedList.h"
using namespace std;
template<class Type>
class orderedLinkedListType : public linkedListType<Type>
{
public:
bool search(const Type& searchItem);
void insertNode(const Type& newItem);
void deleteNode(const Type& deleteItem);
protected:
};
#endif
|
The main program:
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
|
#include<iostream>
#include "orderedLinkedListType.h"
using namespace std;
int main()
{
orderedLinkedListType<int> list1, list2;
int num;
cout<< "Enter integers ending with -999"<<endl;
cin >>num;
while(num != -999)
{
list1.insertNode(num);
cin >> num;
}
cout <<endl;
cout<<" List 1: " << list1 << endl;
list2 = list1 ; //test the assignment operator
cout << "List 2: " << list2 << endl;
cout <<" Enter the number to be "
<<"deleted: ";
cin >> num;
cout << endl;
list2.deleteNode(num);
cout<<" After deleting the node, "
<<"List 2: " << endl << list2 << endl;
return 0;
}
|