472,371 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 software developers and data experts.

expected constructor, destructor, or type conversion before '*'

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 Tclass 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<Tzeile, 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
Sep 20 '06 #1
5 24557

Preben wrote:
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:
<snip>

It would be easier if you told us which is line 25.

Sep 20 '06 #2
Preben wrote:
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>
template<class T>
KGreyImage<T>::dotOutput * KGreyImage<T>::findDots(const int distExpect,
int& dotCount) const {
dotOutput* dotList = new dotOutput[dotCount];
return dotList;
Within a class or function template, it is necessary label (with the
"typename" keyword) any name-dependent type, such as "dotOutput". So in
this case, the findDots function template declaration should be:

template<class T>
typename KGreyImage<T>::dotOutput *
KGreyImage<T>::findDots(const int distExpect, int& dotCount) const
{
dotOutput* dotList = new dotOutput[dotCount];
return dotList;
}

in order for it to compile.

Greg

Sep 20 '06 #3
Within a class or function template, it is necessary label (with the
"typename" keyword) any name-dependent type, such as "dotOutput". So in
this case, the findDots function template declaration should be:

template<class T>
typename KGreyImage<T>::dotOutput *
KGreyImage<T>::findDots(const int distExpect, int& dotCount) const
{
dotOutput* dotList = new dotOutput[dotCount];
return dotList;
}

in order for it to compile.
Thanks...

I'll try to do that and see if that works (doesn't have the code on this
computer).
/ Preben
Sep 20 '06 #4

Preben wrote:
Within a class or function template, it is necessary label (with the
"typename" keyword) any name-dependent type, such as "dotOutput". So in
this case, the findDots function template declaration should be:
...
in order for it to compile.

Thanks...

I'll try to do that and see if that works (doesn't have the code on this
computer).
Well in the interests of not prolonging the suspense, I will reveal
that I have already compiled your code (at least the part you posted)
with my fix on my computer and did so successfully.

Now, I will say that I had much more trouble understanding the
comments. The spelling is simply atrocious.

Greg

ps. oh, :-)

Sep 20 '06 #5
Greg wrote:
Preben wrote:
>>Within a class or function template, it is necessary label (with the
"typename" keyword) any name-dependent type, such as "dotOutput". So in
this case, the findDots function template declaration should be:
...
in order for it to compile.
Thanks...

I'll try to do that and see if that works (doesn't have the code on this
computer).

Well in the interests of not prolonging the suspense, I will reveal
that I have already compiled your code (at least the part you posted)
with my fix on my computer and did so successfully.

Now, I will say that I had much more trouble understanding the
comments. The spelling is simply atrocious.

Greg
Oh, just found out that I hadn't removed all the german comments.

And to reveal that I didn't write the code either - I'm just trying to
make the 8 years of work compile on my gentoo workstation where I
haven't got the possibility to go with gcc 3.3, which is the only
compiler that the code compiles with!
It's really a problem when every part of the code doesn't compile, files
are many thousand lines and probably around 50 errors in each ;-(
/ Preben
Sep 20 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Zenon | last post by:
Folks, I cannot figure out why I am getting an error: Error E2303 EngineX.hpp 19: Type name expected. Here is my code. Can you please help? #ifndef EngineX__hpp #define EngineX__hpp ...
5
by: Damien | last post by:
Hi all, I'm using a pretty standard C++ Singleton class, as below: template <typename T> class Singleton { public: static T* Instance() {
2
by: algatt | last post by:
Hello, I am trying to compile the TPIE files but there is a file that's constantly giving errors about the templates. I am using gcc 3.4.5 on Eclipse using Windows XP. The following is the code of...
5
by: amitmool | last post by:
hi, i have used the queue library file and try to use the template as template <class QueueItem> queue <QueueItem>::~queue() // line 25 { } template <class QueueItem> void...
13
by: JD | last post by:
Hi, My associate has written a copy constructor for a class. Now I need to add an operator = to the class. Is there a way to do it without change her code (copy constructor) at all? Your help...
12
by: Rahul | last post by:
Hi Everyone, I have the following code and i'm able to invoke the destructor explicitly but not the constructor. and i get a compile time error when i invoke the constructor, why is this so? ...
2
by: parvtb | last post by:
I have the following code: #include <list> using namespace std; template <typename T> list<T>::iterator doStuff( list<T>::iterator myIter ) //--error here
11
by: Peter Jansson | last post by:
Dear newsgroup, In the following code, it looks as though the exception thrown in the constructor is not caught properly. I get this output: ---- standard output ---- Base() constructor....
10
by: preeya | last post by:
Hi, I have written the following program: ------------------------------------------------------------------------------------------------------------- 1 #include <stdio.h> 2 #include...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.