• Create Account

#Actualpinebanana

Posted 23 January 2013 - 12:56 AM

The compiler is probably getting confused if you inline it and it isn't available to all translation units (i.e. you need to define it in the class declaration or in the header)?

haha yes that solved it... stupid me for not seeing it myself
i just removed the 'inline' keyword. took me some time googling to fully understand whats going on, but i get it now

this can be closed i guess

thanks a plenty to everyone again, <3 this forum

EDIT: i also moved to returning a reference for assignments:

Vector3 &Vector3::operator=(const Vector3 &v)
{
x = v.x;
y = v.y;
z = v.z;
return *this;
}


i assume this the proper way to do this?

Shouldn't it be:

Vector3& Vector3::operator=(const Vector3& v)
{
if(this != &v)
{
x = v.x;
y = v.y;
z = v.z;
}

return *this;
}

Oh and why not use a pre-made math library such as GLM?

The compiler is probably getting confused if you inline it and it isn't available to all translation units (i.e. you need to define it in the class declaration or in the header)?

haha yes that solved it... stupid me for not seeing it myself
i just removed the 'inline' keyword. took me some time googling to fully understand whats going on, but i get it now

this can be closed i guess

thanks a plenty to everyone again, <3 this forum

EDIT: i also moved to returning a reference for assignments:

Vector3 &Vector3::operator=(const Vector3 &v){    x = v.x;    y = v.y;     z = v.z;    return *this;}

i assume this the proper way to do this?

Shouldn't it be:

[CODE]Vector3&be:

Vector3& Vector3::operator=(const Vector3& v){ v){       if(this != &v)       {             x = v.x;             y = v.y;             z = v.z;       }              return *this;}[/CODE]*this;}

Oh and why not use a pre-made math library such as GLM?

#2pinebanana

Posted 23 January 2013 - 12:55 AM

The compiler is probably getting confused if you inline it and it isn't available to all translation units (i.e. you need to define it in the class declaration or in the header)?

haha yes that solved it... stupid me for not seeing it myself
i just removed the 'inline' keyword. took me some time googling to fully understand whats going on, but i get it now

this can be closed i guess

thanks a plenty to everyone again, <3 this forum

EDIT: i also moved to returning a reference for assignments:

Vector3 &Vector3::operator=(const Vector3 &v)
{
x = v.x;
y = v.y;
z = v.z;
return *this;
}


i assume this the proper way to do this?

Shouldn't it be:

Vector3& Vector3::operator=(const Vector3& v)
{
if(this != &v)
{
x = v.x;
y = v.y;
z = v.z;
}

return *this;
}

The compiler is probably getting confused if you inline it and it isn't available to all translation units (i.e. you need to define it in the class declaration or in the header)?

haha yes that solved it... stupid me for not seeing it myself
i just removed the 'inline' keyword. took me some time googling to fully understand whats going on, but i get it now

this can be closed i guess

thanks a plenty to everyone again, <3 this forum

EDIT: i also moved to returning a reference for assignments:

Vector3 &Vector3::operator=(const Vector3 &v){    x = v.x;    y = v.y;     z = v.z;    return *this;}

i assume this the proper way to do this?

Shouldn't it be:

[CODE]

Vector3 &Vector3::operator=(const Vector3 &v){        if(thisbe: [CODE]Vector3& Vector3::operator=(const Vector3& v){       if(this != &v)        {                        x&v)       {             x = v.x;                            yv.x;             y = v.y;                            zv.y;             z = v.z;        }    return *this;}
[/CODE]v.z;       }           return *this;}[/CODE]

#1pinebanana

Posted 23 January 2013 - 12:54 AM

The compiler is probably getting confused if you inline it and it isn't available to all translation units (i.e. you need to define it in the class declaration or in the header)?

haha yes that solved it... stupid me for not seeing it myself
i just removed the 'inline' keyword. took me some time googling to fully understand whats going on, but i get it now

this can be closed i guess

thanks a plenty to everyone again, <3 this forum

EDIT: i also moved to returning a reference for assignments:

Vector3 &Vector3::operator=(const Vector3 &v)
{
x = v.x;
y = v.y;
z = v.z;
return *this;
}


i assume this the proper way to do this?

Shouldn't it be:


</p><pre>
Vector3 &Vector3::operator=(const Vector3 &v)
{
if(this != &v)
{
x = v.x;
y = v.y;
z = v.z;
}

return *this;
}</pre>

PARTNERS
Warning: include_once(RContent/redis.php): failed to open stream: No such file or directory in /var/www/gamedev/admin/applications_addon/ips/ccs/sources/pages.php(458) : eval()'d code on line 4899 Warning: include_once(): Failed opening 'RContent/redis.php' for inclusion (include_path='/var/www/gamedev/ips_kernel/PEAR/') in /var/www/gamedev/admin/applications_addon/ips/ccs/sources/pages.php(458) : eval()'d code on line 4899