Hi, I'm working on a project to create a robotics simulation environment based on c++ and opengl. Right now I'm stuck trying to solve a compilation error that I'm getting while trying to push_back an object from one of my classes.
Here's part of the code:
Ok, the error I'm getting is:
when I try to do a push_back here:
This used to work properly until I added the class Axes object to the RobotJoint class. Can anyone tell me what am I doing wrong?
Here's part of the code:
Code:
class RobotStruct
{
public:
RobotStruct();
virtual ~RobotStruct();
void AddJoint(float Theta, float Alpha, float a, float d, int Type);
void PopJoint(int ID) { Joints.erase(Joints.begin()+ID); }
void DrawRobot();
private:
std::vector<RobotJoint> Joints;
};
Code:
class RobotJoint
{
public:
RobotJoint();
virtual ~RobotJoint();
void Set(float _Theta, float _Alpha, float _a, float _d, int _Type);
void Draw(int ID);
private:
int Type;
float Theta;
float Alpha;
float a;
float d;
Axes JointAxes;
};
Code:
class Axes
{
public:
Axes();
virtual ~Axes();
void SetID(char* _ID) { ID=_ID; }
char* GetID() const { return ID; }
void SetOrigin(Vector _Origin) { Origin=_Origin; }
void SetOrigin(float _x, float _y, float _z) { Origin.x=_x; Origin.y=_y; Origin.z=_z; }
void SetAxes(Vector X, Vector Y, Vector Z);
void SetAxes(float Xx, float Xy, float Xz, float Yx, float Yy, float Yz, float Zx, float Zy, float Zz);
void PrintSolid(float Length, float Width, int Resolution, bool OnTop) const;
void PrintWire(float Length, float Width, int Resolution, bool OnTop) const;
private:
char* ID;
Vector Origin;
Vector AxisX;
Vector AxisY;
Vector AxisZ;
};
Code:
c:\program files\microsoft visual studio\vc98\include\xutility(39) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'const class RobotJoint' (or there is no acceptable conversion)
c:\program files\microsoft visual studio\vc98\include\vector(170) : see reference to function template instantiation 'void __cdecl std::fill(class RobotJoint *,class RobotJoint *,const class RobotJoint &)' being compiled
Code:
void RobotStruct::AddJoint(float Theta, float Alpha, float a, float d, int Type) {
RobotJoint Joint;
Joint.Set(Theta, Alpha, a, d, Type);
Joints.push_back(Joint);
}
Comment