Curious Compiler Issue?
Code:
GLVector4 Get_xDir()
{
// original code
//return GLVector4(1-2*(y*y+z*z), 2*(x*y+w*z), 2*(x*z-w*y));
// xcode acceptable code
GLVector4 v4(1-2*(y*y+z*z), 2*(x*y+w*z), 2*(x*z-w*y));
return(v4);
}This was some code off the internet (Linux and Windows) and that I tried
compiling but the errors:
no matching function for call to "GLVector4::GLVector4(GLVector4);
candidates are : GLVector4::GLVector4(GLVector4&);
After much head banking I got it to work by splitting up line as shown above.
Note: I tried
return ( GLVector4(1-2*(y*y+z*z), 2*(x*y+w*z), 2*(x*z-w*y)) );
but this didn't work either.
Could this be an error in Xcode (i.e. gcc ) comipler?
Edit: Just came across this. Must be in the same vein as the above.
Had to change this:
distance = distance2Points(GLVector3(particlePos.x, particlePos.y, particlePos.z),
GLVector3(m_forcesPos[i].x, m_forcesPos[i].y, m_forcesPos[i].z));
to this:
GLVector3 v3(particlePos.x, particlePos.y, particlePos.z);
GLVector3 v3_1(m_forcesPos[i].x, m_forcesPos[i].y, m_forcesPos[i].z);
distance = distance2Points(v3, v3_1);
Your copy constructor should take a const GLVector4&, not a GLVector4&.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Weird Compiler WARNING... help? | Elphaba | 1 | 1,767 |
Aug 10, 2009 10:51 PM Last Post: Elphaba |
|
| compiler (pre-processing?) error of SDL project | WhatMeWorry | 2 | 2,600 |
Oct 14, 2005 09:09 PM Last Post: WhatMeWorry |
|
| weird compiler warnings/errors in Xcode 2.0 | Andrew | 15 | 6,101 |
May 13, 2005 01:07 AM Last Post: Andrew |
|

