Hello everyone,
I am encountering a strange problem. I built a photon application. And there is a callback of a button wrote as below:
typedef struct Position3dStruct
{
float x;
float y;
float z;
} Position3d;
/* QUATERNION Structure */
typedef struct QuatRotationStruct
{
float q0;
float qx;
float qy;
float qz;
} QuatRotation;
typedef struct
{
unsigned long
ulFlags,
ulFrameNumber;
QuatRotation
rotation;
Position3d
translation;
float
fError;
}TransformInformation;
TransformInformation Xfrms[0xFF];
typedef struct QuatTransformationStruct
{
QuatRotation rotation;
Position3d translation;
} QuatTransformation;
void QuatRotatePoint( QuatRotation *RotationQuaternionPtr,
Position3d *OriginalPositionPtr,
Position3d RotatedPositionPtr )
{
Position3d
UCrossV; / The cross product of the vector part of the rotation
quaternion with the original position vector */
if( OriginalPositionPtr->x < MAX_NEGATIVE ||
OriginalPositionPtr->y < MAX_NEGATIVE ||
OriginalPositionPtr->z < MAX_NEGATIVE )
{
RotatedPositionPtr->x =
RotatedPositionPtr->y =
RotatedPositionPtr->z = BAD_FLOAT;
return;
} /* if */
UCrossV.x = RotationQuaternionPtr->qy * OriginalPositionPtr->z
- RotationQuaternionPtr->qz * OriginalPositionPtr->y;
UCrossV.y = RotationQuaternionPtr->qz * OriginalPositionPtr->x - RotationQuaternionPtr->qx * OriginalPositionPtr->z;
UCrossV.z = RotationQuaternionPtr->qx * OriginalPositionPtr->y - RotationQuaternionPtr->qy * OriginalPositionPtr->x;
RotatedPositionPtr->x = float(OriginalPositionPtr->x
- 2.0 * ( RotationQuaternionPtr->q0*UCrossV.x
- RotationQuaternionPtr->qy*UCrossV.z
- RotationQuaternionPtr->qz*UCrossV.y ));
RotatedPositionPtr->y = float(OriginalPositionPtr->y
- 2.0 * ( RotationQuaternionPtr->q0*UCrossV.y
- RotationQuaternionPtr->qz*UCrossV.x
- RotationQuaternionPtr->qx*UCrossV.z ));
RotatedPositionPtr->z = float(OriginalPositionPtr->z
- 2.0 * ( RotationQuaternionPtr->q0*UCrossV.z
- RotationQuaternionPtr->qx*UCrossV.y
- RotationQuaternionPtr->qyUCrossV.x ));
} / QuatRotatePoint */
int mycallback(Ptwiget…)
{
…
…
return(Ptcontinue);
}
The application is no problem, when I finished write these code, and the result is also right. But after I closed the project, and re-open it, there are problems:
In file included from /root/20081201/sercheck/src/abmain.cc:37:
/root/20081201/sercheck/src/proto.h:26: error: variable or field ‘QuatRotatePoint’ declared void
/root/20081201/sercheck/src/proto.h:26: error: ‘QuatRotation’ was not declared in this scope
/root/20081201/sercheck/src/proto.h:26: error: ‘RotationQuaternionPtr’ was not declared in this scope
/root/20081201/sercheck/src/proto.h:26: error: ‘Position3d’ was not declared in this scope
/root/20081201/sercheck/src/proto.h:26: error: ‘OriginalPositionPtr’ was not declared in this scope
/root/20081201/sercheck/src/proto.h:26: error: ‘Position3d’ was not declared in this scope
/root/20081201/sercheck/src/proto.h:26: error: ‘RotatedPositionPtr’ was not declared in this scope
cc: /usr/qnx640/host/qnx6/x86/usr/lib/gcc/i386-pc-nto-qnx6.4.0/4.2.4/cc1plus error 1
make[2]: *** [abmain.o] Error 1
make[2]: Leaving directory /root/20081201/sercheck/x86/o-g' make[1]: *** [all] Error 2 make[1]: Leaving directory
/root/20081201/sercheck/x86’
make: *** [all] Error 2
I checked the proto.h, there is a declarer about the function:
void QuatRotatePoint( QuatRotation *RotationQuaternionPtr, Position3d *OriginalPositionPtr, Position3d *RotatedPositionPtr ),
if I delete this declarer, the project is ok, compiled, executed all ok. But after I close the project and re-open it. The same problem appears again.
and the previous declarer appears again in the proto.h…
what’s the problem?
Thanks a lot,
Jason