joeGrammar
Programmer
I'm getting these errors:
area\rel2\batch\ice\badcall.cpp(15) : error C2143: syntax error : missing ';' before '->'
c:\temp\apps\brp_dev_area\rel2\batch\ice\badcall.cpp(15) : error C2501: 'DynEle' : missing storage-class or type specifiers
c:\temp\apps\brp_dev_area\rel2\batch\ice\badcall.cpp(15) : error C2040: 'DynEle' : 'int' differs in levels of indirection from 'class DynArray<class Temp> *'
c:\temp\apps\brp_dev_area\rel2\batch\ice\badcall.cpp(15) : error C2143: syntax error : missing ';' before '->'
Error executing cl.exe.
The code is such:
badcall.cpp
#include <stdlib.h>
#include "qsort.hpp"
class Temp
{
};
DynArray <Temp> *DynEle;
int tester = 1;
DynEle->SortElements(tester);
int main(){ return -1;}
and qsort.hpp(class section):
template <class T>
class DynArray : public vector<T*>
{
public:
typedef const T* TCPtr;
public:
// DynArray(t_index lNbElem) { vector<T*>::reserve(lNbElem); };
DynArray() {cout << "constructed";};
~DynArray() {};
public:
void SortElements( int (*fCmp)( const TCPtr *ppe1, const TCPtr *ppe2 ) )
{
sort( vector<T*>::begin(), vector<T*>::end(),
qsort2sort(STD_NAMESPACE ptr_fun(fCmp)) );
}
void SortElements( int (*cmp)( const void *e1, const void *e2 ) )
{
SortElements( reinterpret_cast<int (*)( const TCPtr *ppe1, const TCPtr *ppe2 )>(cmp));
}
};
Anyhoo any help would be appreciated
area\rel2\batch\ice\badcall.cpp(15) : error C2143: syntax error : missing ';' before '->'
c:\temp\apps\brp_dev_area\rel2\batch\ice\badcall.cpp(15) : error C2501: 'DynEle' : missing storage-class or type specifiers
c:\temp\apps\brp_dev_area\rel2\batch\ice\badcall.cpp(15) : error C2040: 'DynEle' : 'int' differs in levels of indirection from 'class DynArray<class Temp> *'
c:\temp\apps\brp_dev_area\rel2\batch\ice\badcall.cpp(15) : error C2143: syntax error : missing ';' before '->'
Error executing cl.exe.
The code is such:
badcall.cpp
#include <stdlib.h>
#include "qsort.hpp"
class Temp
{
};
DynArray <Temp> *DynEle;
int tester = 1;
DynEle->SortElements(tester);
int main(){ return -1;}
and qsort.hpp(class section):
template <class T>
class DynArray : public vector<T*>
{
public:
typedef const T* TCPtr;
public:
// DynArray(t_index lNbElem) { vector<T*>::reserve(lNbElem); };
DynArray() {cout << "constructed";};
~DynArray() {};
public:
void SortElements( int (*fCmp)( const TCPtr *ppe1, const TCPtr *ppe2 ) )
{
sort( vector<T*>::begin(), vector<T*>::end(),
qsort2sort(STD_NAMESPACE ptr_fun(fCmp)) );
}
void SortElements( int (*cmp)( const void *e1, const void *e2 ) )
{
SortElements( reinterpret_cast<int (*)( const TCPtr *ppe1, const TCPtr *ppe2 )>(cmp));
}
};
Anyhoo any help would be appreciated