Gallo
October 12, 2014, 10:28am
#1
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
arturo
October 12, 2014, 11:47am
#2
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
Gallo
October 12, 2014, 3:00pm
#3
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.
Gallo
October 12, 2014, 3:14pm
#4
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
Gallo
October 12, 2014, 8:58pm
#5
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.
arturo
October 12, 2014, 9:07pm
#6
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?
arturo
May 11, 2017, 8:35pm
#9
probably ofxCv;;FlowFarneback doens’t have a const draw