0
这里的point.h未知类型名称矢量
#ifndef POINT_H_
#define POINT_H_
#include "/Users/Verdonckt/Documents/3dlaboNogMaarEens/3dlaboNogMaarEens/src/util/Vector.h"
class Point {
public:
double x;
double y;
double z;
Point(double x=0, double y=0, double z=0): x(x), y(y), z(z){ }
void set(double x, double y, double z);
friend Vector operator-(const Point& left, const Point& right);
};
#endif /* POINT_H_ */
此文件提供了有关行错误:
friend Vector operator-(const Point& left, const Point& right);
说未知类型名称: 我认为,包括作品,因为它不给如果将其更改为不存在的文件,则会发生错误。
这里的Vector.h:再次
#ifndef VECTOR_H_
#define VECTOR_H_
#include "Point.h"
class Vector {
public:
double x, y, z;
Vector(double x=0, double y=0, double z=0):x(x), y(y), z(z){ }
Vector(const Point & from, const Point & to);
Vector(const Point& p):x(p.x),y(p.y), z(p.z){ }
double getX(){return x;}
double getY(){return y;}
double getZ(){return z;}
friend Vector operator*(const Vector & v, double a);
friend Vector operator*(double a, const Vector & v);
friend Point operator+(const Point & p, const Vector & v);
friend Point operator+(const Vector & v, const Point & p);
friend Vector operator+(const Vector & v1, const Vector & v2);
friend Vector operator-(const Vector& v1, const Vector& v2);
double dot(const Vector & v);
Vector cross(const Vector & v);
double length();
void normalize();
};
#endif /* VECTOR_H_ */
一旦说上线:
friend Point operator+(const Point & p, const Vector & v);
friend Point operator+(const Vector & v, const Point & p);
Vector(const Point & from, const Point & to);
Vector(const Point& p):x(p.x),y(p.y), z(p.z){ }
未知类型名称 '点'
这是为什么?如何解决这个问题?
你有一个标题之间的循环依赖关系。 –
可能的重复[错误2061 - 类成为“未定义”,当我包括一个标题](http://stackoverflow.com/questions/8010601/error-2061-class-becomes-undefined-when-i-include-a-标题) –