abel abadi
January 16th, 2011, 05:17 PM
I use g++ compiler for my c++ programming! And i keep getting this error
hashtbl.h:21: error: ISO C++ forbids declaration of ‘List’ with no type
hashtbl.h:21: error: expected ‘;’ before ‘<’ token
hashtbl.cpp: In constructor ‘HashTbl<DT, KF>::HashTbl(int)’:
hashtbl.cpp:11: error: ‘dataTable’ was not declared in this scope
here is some part of my program:
------------------------------------hashtbl.h
template < class DT, class KF >
class HashTbl
{
public:
HashTbl ( int initTableSize );
~HashTbl ();
-------------------hashtbl.cpp
#include<iostream>
#include <new>
#include "hashtbl.h"
#include "listlnk.cpp"
using namespace std;
template < class DT, class KF >
HashTbl<DT,KF>:: HashTbl ( int initTableSize )
{
tableSize=initTableSize;
dataTable = new List<DT>[tableSize];
}
-------------------------linklis.h
template < class DT > // Forward declaration of the List class
class List;
template < class DT >
class ListNode // Facilitator class for the List class
{
private:
// Constructor
-----------------------------linklis.cpp
#include <iostream>
#include "listlnk.h"
#include <new>
using namespace std;
//--------------------------------------------------------------------
template < class DT >
ListNode<DT>:: ListNode ( const DT &nodeDataItem, ListNode<DT> *nextPtr )
// Creates a list node containing item elem and next pointer
// nextPtr.
please anybody help me out!
with regards!
hashtbl.h:21: error: ISO C++ forbids declaration of ‘List’ with no type
hashtbl.h:21: error: expected ‘;’ before ‘<’ token
hashtbl.cpp: In constructor ‘HashTbl<DT, KF>::HashTbl(int)’:
hashtbl.cpp:11: error: ‘dataTable’ was not declared in this scope
here is some part of my program:
------------------------------------hashtbl.h
template < class DT, class KF >
class HashTbl
{
public:
HashTbl ( int initTableSize );
~HashTbl ();
-------------------hashtbl.cpp
#include<iostream>
#include <new>
#include "hashtbl.h"
#include "listlnk.cpp"
using namespace std;
template < class DT, class KF >
HashTbl<DT,KF>:: HashTbl ( int initTableSize )
{
tableSize=initTableSize;
dataTable = new List<DT>[tableSize];
}
-------------------------linklis.h
template < class DT > // Forward declaration of the List class
class List;
template < class DT >
class ListNode // Facilitator class for the List class
{
private:
// Constructor
-----------------------------linklis.cpp
#include <iostream>
#include "listlnk.h"
#include <new>
using namespace std;
//--------------------------------------------------------------------
template < class DT >
ListNode<DT>:: ListNode ( const DT &nodeDataItem, ListNode<DT> *nextPtr )
// Creates a list node containing item elem and next pointer
// nextPtr.
please anybody help me out!
with regards!