fixed : error using operator overload :(

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Stellar
Posts: 48
Joined: Mon Dec 12, 2005 9:13 am

fixed : error using operator overload :(

Post by Stellar »

EDIT : Nevermind I found it. That was discreet, I was passing the wrong type to the function. anyways, if i could delete threads in these forums, ild be able to remove about half of mine.

__________________________

I've never really practiced operator overloading, but im getting an error as a result of my ignorance. thought mabey someone would know how to fix the problem.
From the error message it looks like it knows what function to use. Im not sure why it doesnt qualify?

any ideas?,
thx,
-stellar

___ error ____
MyCamera.cpp: In member function 'void MyCamera::LookAt(MyScePspFVector3, MyScePspFVector3, MyScePspFVector3)':
MyCamera.cpp:45: error: no match for 'operator-' in 'target - pos'
MyLinearMathUtils.h:20: note: candidates are: ScePspFVector3 MyScePspFVector3::operator-(ScePspFVector3)

____ code____

Code: Select all

ScePspFVector3 MyScePspFVector3::operator - ( ScePspFVector3 param )
{
	MyScePspFVector3 result ( 
		this->vector.x - param.x,
		this->vector.y - param.y,
		this->vector.z - param.z
	);

	return result.vector;
}

Code: Select all

void MyCamera::LookAt(
	MyScePspFVector3 &pos, 
	MyScePspFVector3 &target, 
	MyScePspFVector3 &up
)
{
	MyScePspFVector3 temp = &#40; target - pos &#41;;  <-- error happens here
&#125;

&#58;&#58; EDIT - FIXED &#58;&#58;
as you can see, target and pos are not of ScePspFVector3 type.
Image
Post Reply