65,179
社区成员




typedef struct Vector3f
{
Vector3f(float _x, float _y, float _z) :x(_x), y(_y), z(_z), entryPoint(NULL) {}
float x, y, z;
Edge* entryPoint;
/* 这个赋值搞错了吧,参数应该是Vector3f &,编译器应该有相关提示吧 */
Vector3f& operator=(const Vector3& vec3)
{
x = vec3.x;
y = vec3.y;
z = vec3.z;
entryPoint = NULL;
}
}*pVector3f;
typedef struct Vector3
{
float x, y, z;
Vector3(float _x,float _y,float _z):x(_x),y(_y),z(_z){}
}*pVector3;
把struct Vector3的声明提前,遵循先声明后使用的原则;
结构体struct Vector3f中,这些操作是对结构体struct Vector3的结构体成员的使用,所以声明必须在前;
Vector3f& operator=(const Vector3& vec3)
{
x = vec3.x;
y = vec3.y;
z = vec3.z;
entryPoint = NULL;
}
struct Edge;
struct Vector3f;
struct Vector3;
typedef struct Vector3
{
float x, y, z;
Vector3(float _x, float _y, float _z) :x(_x), y(_y), z(_z) {}
}*pVector3;
typedef struct Vector3f
{
Vector3f(float _x, float _y, float _z) :x(_x), y(_y), z(_z), entryPoint(NULL) {}
float x, y, z;
Edge* entryPoint;
Vector3f& operator=(const Vector3& vec3)
{
x = vec3.x;
y = vec3.y;
z = vec3.z;
entryPoint = NULL;
}
}*pVector3f;
struct Edge
{
};
把vector3放前面定义就行了!至于为什么,我就不知道!你还得看看声明了