"error C2677: binary '*'" for already overloaded operator

Dear person who reads this,

I'm working on my own math classes for vertices and matrices for a school project and for that I have overloaded several operators. One of them I'm using in several functions of the vector class, but I get the following error for that:

1>e:\farao engine\farao engine svn\trunk\farao engine\faraovector3d.cpp(44): error C2677: binary '*' : no global operator found which takes type 'FARAO::FARAOMatrix44' (or there is no acceptable conversion)


The function is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
*Rotate this vector argDegrees over it's X-axis.
*/
FARAOVector3D FARAOVector3D::VectorRotationMatrixForX(double argDegrees)
{
	//Initializes the vector that is to be returned.
	FARAOVector3D vectorResult;

	//Initializes and defines the rotation matrix.
	FARAOMatrix44 rotationMatrix;
	rotationMatrix.setAsIdentityMatrix();
	rotationMatrix.matrix44[1][1] = cos(argDegrees);
	rotationMatrix.matrix44[1][2] = sin(argDegrees);
	rotationMatrix.matrix44[2][1] = -sin(argDegrees);
	rotationMatrix.matrix44[2][2] = cos(argDegrees);

	//Calculates the vector that is to be returned.
        //This part causes the error.
	vectorResult = this * rotationMatrix;

	//Returns the vector that is to be returned.
	return vectorResult;
}


I have overloaded the operator* like so:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//Overloading the * operator for multiplying a vector with a 4x4 matrix.
FARAOVector3D operator* (FARAOMatrix44 argMatrix44)
	{

	//Initializes the vector that is to be returned.
	FARAOVector3D vectorResult;

	//Calculate the x position.
	vectorResult.vector3D[0] =
		vector3D[0] * argMatrix44.matrix44[0][0] +
		vector3D[1] * argMatrix44.matrix44[1][0] +
		vector3D[2] * argMatrix44.matrix44[2][0] +
		argMatrix44.matrix44[3][0];

	//Calculate the y position.
	vectorResult.vector3D[1] =
		vector3D[0] * argMatrix44.matrix44[0][1] +
		vector3D[1] * argMatrix44.matrix44[1][1] +
		vector3D[2] * argMatrix44.matrix44[2][1] +
		argMatrix44.matrix44[3][1];

	//Calculate the x position.
	vectorResult.vector3D[2] =
		vector3D[0] * argMatrix44.matrix44[0][2] +
		vector3D[1] * argMatrix44.matrix44[1][2] +
		vector3D[2] * argMatrix44.matrix44[2][2] +
		argMatrix44.matrix44[3][2];

	//Returns the vector that is to be returned.
	return vectorResult;
}


Is there something I have overlooked that could cause the error?
Or should I try to solve it in another way?

Thank you in advance,
Friso
this is a pointer so you need to dereference it.
vectorResult = *this * rotationMatrix;

Thank you!
That solved the compile errors :D
Topic archived. No new replies allowed.