We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I'm having a 'constructor is undefined' error that makes little sense. The initial code of my library is:
package gazetrack;
import processing.core.*;
import java.lang.reflect.Method;
public class GazeTrack
{
PApplet myParent;
private GazeStream dataStream;
private Method gazeStopped, gazeStarted;
public GazeTrack(PApplet myParent)
{
this.myParent = myParent;
myParent.registerMethod("dispose", this);
initGazeTrackMethods();
welcome();
dataStream = new gazetrack.GazeStream(this);
}
...
}
And in Processing:
import gazetrack.*;
GazeTrack gt;
void setup()
{
size(displayWidth, displayHeight);
gt = new GazeTrack(this);
}
The error is the following:
The constructor GazeTrack(GazeTrack) is undefined.
Answers
Dunno what's wrong either. Deducing from "The constructor GazeTrack(GazeTrack) is undefined.", you're trying to pass a GazeTrack rather than a PApplet reference to it! @-)
Dunno why would it think that the
this
ingt = new GazeTrack(this);
wouldn't be a PApplet? :-/I think the problem is not what I'm passing to the constructor. If I change:
public GazeTrack(PApplet myParent)
topublic GazeTrack(int test)
and
gt = new GazeTrack(this);
togt = new GazeTrack(2);
I still get:
The constructor GazeTrack(int) is undefined.
i'm guessing your project is called GazeTrack. so you have actually have two classes called GazeTrack... try changing the project name or the object name
It's still weird saying "The constructor GazeTrack(GazeTrack) is undefined."!
It shoulda been: "The constructor GazeTrack(PApplet) is undefined."
That is, somehow, it thinks that setup() lives in a GazeTrack instead of PApplet class!
Oh, like @koogs said, that is much probably the culprit. Processing's pre-processor uses the name of the 1st main tab as the wrapper class name for all the ".pde" tabs!
You got a a class name collision there! (~~)
I suspect that your sketch is also called GazeTrack. Processing wraps up you sketch in a class with the same name.
It's finally working :) Thanks everyone!
It is an error so classical it was in the Technical FAQ for which I still must find some time to restore...