A
Ami
Hi All,
I have declared and defined a template based class in header
file but when I try to compile it, it throws follwoign errors:
error C2143: syntax error : missing ';' before '<'
error C2501: 'CSVReader<T>::vector' : missing storage-class or type
specifiers
error C2238: unexpected token(s) preceding ';'
error C2146: syntax error : missing ';' before identifier 'ifs'
error C2501: 'CSVReader<T>::ifstream' : missing storage-class or type
specifiers
error C2501: 'CSVReader<T>::ifs' : missing storage-class or type
specifiers
error C2065: 'T' : undeclared identifier
........
........
The class declaration/definition is as follows:
//templateclass.h
typedef struct _mystruct
{
char myparam[256];
}mystruct;
template <class T>
class TempClass{
private:
vector<T> *mystruct;
long MAX_COL;
ifstream ifs;
public:
TempClass(char* inchar);
~TempClass();
};
CSVReader<T>::CSVReader(char *csv)
{
//
}
template <class T> CSVReader<T>::~CSVReader()
{
//
}
Any help is highly appreciated.
Regards
I have declared and defined a template based class in header
file but when I try to compile it, it throws follwoign errors:
error C2143: syntax error : missing ';' before '<'
error C2501: 'CSVReader<T>::vector' : missing storage-class or type
specifiers
error C2238: unexpected token(s) preceding ';'
error C2146: syntax error : missing ';' before identifier 'ifs'
error C2501: 'CSVReader<T>::ifstream' : missing storage-class or type
specifiers
error C2501: 'CSVReader<T>::ifs' : missing storage-class or type
specifiers
error C2065: 'T' : undeclared identifier
........
........
The class declaration/definition is as follows:
//templateclass.h
typedef struct _mystruct
{
char myparam[256];
}mystruct;
template <class T>
class TempClass{
private:
vector<T> *mystruct;
long MAX_COL;
ifstream ifs;
public:
TempClass(char* inchar);
~TempClass();
};
CSVReader<T>::CSVReader(char *csv)
{
//
}
template <class T> CSVReader<T>::~CSVReader()
{
//
}
Any help is highly appreciated.
Regards