P
Preben
Hi,
I get this error when trying to compile:
--------
# g++ -c KGreyImage.cpp
KGreyImage.cpp:25: error: expected constructor, destructor, or type
conversion before '*' token
--------
and the code is given here:
--------
#include <vector>
/** defines fuer Funktion KGreyImage<T>::edges(), geben an, was nach der
Berechnung des Gradientenbetrags
// noch alles gemacht werden soll
*/
#define SUPPRESS_NONMAXIMA 1
#define DOUBLE_THRESHOLDING 2
#define CANNY 3
template<class T> class KGreyImage {
private:
/** diese structs werden von ::findDots() benoetigt*/
struct point {
double x;
double y;
double mindist[5];
int neighbor[5];
int direction[4];
bool inGrid;
};
struct lrud {
double x;
double y;
int index;
};
public:
KGreyImage();
KGreyImage(unsigned int cols, unsigned int rows);
KGreyImage(KGreyImage<T>* pImage);
KGreyImage(KGreyImage<T> &pImage);
KGreyImage(const KGreyImage<T> &pImage);
KGreyImage(T* pImage, unsigned int cols, unsigned int rows);
KGreyImage( std::vector<T> zeile, char orient = 'x' );
struct dotOutput {
/** Position in Grid-Koordinaten */
double gx, gy;
/** Position in Bild-Koordinaten */
double ix, iy;
};
/** Dotliste finden; stuerzt mit "Segmentation fault" ab, wenn im
Bild noch
weitere Daten als nur das Punktmuster enthalten sind
Parameter gibt den ungefaehren horizontalen Abstand zwischen
benachbarten
Punkten an */
dotOutput* findDots(const int distExpect, int& dotCount) const;
};
template<class T>
KGreyImage<T>::KGreyImage() {}
template<class T>
KGreyImage<T>::KGreyImage(unsigned int cols, unsigned int rows) {}
template<class T>
KGreyImage<T>::KGreyImage(const KGreyImage<T>& pImage) {}
template<class T>
KGreyImage<T>::KGreyImage(KGreyImage<T>& pImage) {}
template<class T>
KGreyImage<T>::KGreyImage(KGreyImage<T>* pImage) {}
template<class T>
KGreyImage<T>::dotOutput * KGreyImage<T>::findDots(const int distExpect,
int& dotCount) const {
dotOutput* dotList = new dotOutput[dotCount];
return dotList;
}
--------
Why does gcc 4.1.1 expect a constructor in front of the *?
It should just return a pointer to the new array of dotOutput's!
Thanks in advance
Preben
I get this error when trying to compile:
--------
# g++ -c KGreyImage.cpp
KGreyImage.cpp:25: error: expected constructor, destructor, or type
conversion before '*' token
--------
and the code is given here:
--------
#include <vector>
/** defines fuer Funktion KGreyImage<T>::edges(), geben an, was nach der
Berechnung des Gradientenbetrags
// noch alles gemacht werden soll
*/
#define SUPPRESS_NONMAXIMA 1
#define DOUBLE_THRESHOLDING 2
#define CANNY 3
template<class T> class KGreyImage {
private:
/** diese structs werden von ::findDots() benoetigt*/
struct point {
double x;
double y;
double mindist[5];
int neighbor[5];
int direction[4];
bool inGrid;
};
struct lrud {
double x;
double y;
int index;
};
public:
KGreyImage();
KGreyImage(unsigned int cols, unsigned int rows);
KGreyImage(KGreyImage<T>* pImage);
KGreyImage(KGreyImage<T> &pImage);
KGreyImage(const KGreyImage<T> &pImage);
KGreyImage(T* pImage, unsigned int cols, unsigned int rows);
KGreyImage( std::vector<T> zeile, char orient = 'x' );
struct dotOutput {
/** Position in Grid-Koordinaten */
double gx, gy;
/** Position in Bild-Koordinaten */
double ix, iy;
};
/** Dotliste finden; stuerzt mit "Segmentation fault" ab, wenn im
Bild noch
weitere Daten als nur das Punktmuster enthalten sind
Parameter gibt den ungefaehren horizontalen Abstand zwischen
benachbarten
Punkten an */
dotOutput* findDots(const int distExpect, int& dotCount) const;
};
template<class T>
KGreyImage<T>::KGreyImage() {}
template<class T>
KGreyImage<T>::KGreyImage(unsigned int cols, unsigned int rows) {}
template<class T>
KGreyImage<T>::KGreyImage(const KGreyImage<T>& pImage) {}
template<class T>
KGreyImage<T>::KGreyImage(KGreyImage<T>& pImage) {}
template<class T>
KGreyImage<T>::KGreyImage(KGreyImage<T>* pImage) {}
template<class T>
KGreyImage<T>::dotOutput * KGreyImage<T>::findDots(const int distExpect,
int& dotCount) const {
dotOutput* dotList = new dotOutput[dotCount];
return dotList;
}
--------
Why does gcc 4.1.1 expect a constructor in front of the *?
It should just return a pointer to the new array of dotOutput's!
Thanks in advance
Preben