I've been looking up how to fix this error, apparently it has to do with functions which should be declared const since something they take is const.
I have a base class, graphobj, which has subclasses triangle, quad, etc.
Each subclass calls a function, fill, which takes a few parameters, one of which is a Vector3f.
I'm getting this error:
graphobj.h: In member function ‘void GraphObj::fill(Image&, Vec3f&, Vec2f)’:
graphobj.h:13: error: passing ‘const Vec3f’ as ‘this’ argument of ‘int Vec3f:perator!=(const Vec3f&)’ discards qualifiers
This is the graphobj code:
There are quite a few supporting files, I don't want to attach all of them and make this unreadable. If I need to include more information to figure this out, just tell me.Code:#ifndef _GRAPHOBJ_H_ #define _GRAPHOBJ_H_ #include "image.h" // GraphObj class GraphObj { public: virtual ~GraphObj(); virtual void draw(Image& i) = 0; void fill(Image& i, Vec3f& color, Vec2f point) { if(i.GetPixel((int)point.x(),(int)point.y()) != color){ i.SetPixel((int)point.x(),(int)point.y(),color); fill(i,color,Vec2f(point.x()+1,point.y()+1)); fill(i,color,Vec2f(point.x()-1,point.y()+1)); fill(i,color,Vec2f(point.x()+1,point.y()-1)); fill(i,color,Vec2f(point.x()-1,point.y()-1)); } } }; #endif
How do I solve this issue?? Thanks!



LinkBack URL
About LinkBacks
perator!=(const Vec3f&)’ discards qualifiers




CornedBee