tags:

views:

39

answers:

2

I am getting this error "Expected class-name before ',' token" and "Expected class-name before '{' token" in MainController.h I think I am including files as needed, also doing #ifndef HEADER_H #define HEADER_H, etc in all headers, I had no errors until I wrote MainController class. I have no idea why this error appears. What am I missing here?

I have N4GestureRecognizer.h:

class N4GestureRecognizer;
class N4GestureRecognizerDataSource{ /*it uses N4GestureRecognizer*/ };
class N4GestureRecognizerDelegate{    };
class N4GestureRecognizer {
...    
};

N4FingerTipGestureRecognizer.h

#include "N4GestureRecognizer.h"
class N4FingerTipGestureRecognizer;

class N4FingerTipGestureRecognizerDelegate : public N4GestureRecognizerDelegate{
public:
    virtual void fingerTipGestureRecognizerCallback(N4FingerTipGestureRecognizer *recognizer) = 0;
};
class N4FingerTipGestureRecognizer : public N4GestureRecognizer{
...    
};

And MainController.h

#include "N4GestureRecognizer.h"
#include "N4FingerTipGestureRecognizer.h"

using namespace cv;

//******Error is in the next line******
class MainController : public N4GestureRecognizerDatasource, public N4FingerTipGestureRecognizeDelegate{ 
protected:
    Mat image;
public:
    /*virtual*/ Mat gestureRecognizerNeedsImageFrame(N4GestureRecognizer *recognizer);
    /*virtual*/ void fingerTipGestureRecognizerCallback(N4FingerTipGestureRecognizer *recognizer);

};
+1  A: 

There seem to be two typos in your code:

  1. In N4GestureRecognizer.h you have N4GestureRecognizerDataSource, but you try have MainController inherit from N4GestureRecognizerDatasource; note the different case of the S in DataSource.
  2. In N4FingerTipGestureRecognizer.h you have N4FingerTipGestureRecognizerDelegate, but you try to have MainController inherit from N4FingerTipGestureRecognizeDelegate; note the missing r before Delegate.
Philipp
A good reason for not using very long names.
anon
...and to use an editor/IDE with autocompletion.
Philipp
What a dumb! me. lol. thanks
nacho4d
+1  A: 

Assuming the source you have pasted above is really the text your source contains the problem is in class N4GestureRecognizerDataSource versus public N4GestureRecognizerDatasource.

wilx