[SOLVED] Error Base class has incomplete type

class ofBaseDraws;
class ofRectangle;

class ROI : public ofBaseDraws, public ofRectangle {
    
    public :
    
    void draw(float _x, float _y) const;
    void draw(float _x, float _y, float _w, float _h) const;
    float getWidth() const;
    float getHeight() const;
};

gives me the error :

Base class has incomplete type

What am i doing wrong ?

thanks

you need to include the header in order to be able to extend, forward declaration like you are doing there with:

class ofBaseDraws;
class ofRectangle;

won’t work since the compiler needs to know the details of the class to be able to extend

Thanks for the answer. So should i use instead :

#include <ofRectangle.h>
#include <ofBaseTypes.h>

I mean i am not sure where ofBaseDraws class is defined. ofBaseTypes.h seems the one but i am not sure.

Thanks again.

By the way, i am now having an error when declaring this ROI class.

in my kinectTracker.h i am declaring :

#include <ofxKinect.h>
#include <ofxOpenCv.h>
#include "ROI.h"

class kinectTracker {

public:
    kinectTracker();
    ~kinectTracker();
    
    ROI roi;

private:
    
    ofxKinect kinect;
    
}; 

then i have the error :

Field type ‘ROI’ is an abstract class

Thanks for your suggestions

Ok so i figured out that ofBaseDraws is part of ofBaseTypes and includes 4 pure virtual methods. I thought i could implement them in const but it turns out it can’t !

so i replaced :

void draw(float _x, float _y) const;
void draw(float _x, float _y, float _w, float _h) const;
float getWidth() const;
float getHeight() const;

with :

void draw(float _x, float _y);
void draw(float _x, float _y, float _w, float _h);
float getWidth();
float getHeight();

in my ROI class and everything seems ok now.

Thanks for your help.

we’ve changed that for next release where those methods will be const but by now they have to be non const

I was getting this error then adding the const to the virtual function solved it. Now I am getting the weirdest error, I can not call functions on the flow object all the classes are hidden?

With the help of @NickHardeman if you make the object a pointer it worked ---- but why?

probably ofxCv;;FlowFarneback doens’t have a const draw