这个错误“'形状':'类'类型重定义”和“使用未定义类型'形状'”是什么? 我的shape类和main方法如下所示,shape(int si)构造函数可供我测试节点的遍历,尽管这与错误无关。任何帮助将不胜感激。
#include "mat3.h"
#include "node.h"
#include "shape.h"
#include "vec3.h"
int main(int argc, char *argv[])
{
Node root = Node(shape(0)); //torso
Node head = *root.addChild(shape(1)); //head
Node larm = *root.addChild(shape(2)); //left arm
Node rarm = *root.addChild(shape(3)); //right arm
Node lleg = *root.addChild(shape(4)); //left leg
Node rleg = *root.addChild(shape(5)); //right leg
Node lwing = *larm.addChild(shape(6)); //left wing
Node rwing = *rarm.addChild(shape(7)); //right wing
Node lhand = *larm.addChild(shape(8)); //left hand
Node rhand = *rarm.addChild(shape(9)); //right hand
Node lfoot = *lleg.addChild(shape(10)); //left foot
Node rfoot = *rleg.addChild(shape(11)); //right foot
}
#include <string>
#include <list>
#include "vec3.h"
class shape {
private:
vec3 collor;
std::list<vec3> points;
public:
int s;
shape();
shape(int si);
shape(vec3 collor, std::list<vec3>& points);
vec3 getCollor();
std::list<vec3>* getPoints();
void setCollor(vec3 collor_i);
void setPoints(std::list<vec3>& points_i);
};
#include <string>
#include <list>
#include "vec3.h"
#include "shape.h"
#include <assert.h>
shape::shape() {
collor = vec3();
}
shape::shape(int si) {
s = si;
}
shape::shape(vec3 collor_i, std::list<vec3>& points_i) {
assert(collor_i[0] >= 0 && collor_i[1] >= 0 && collor_i[2] >= 0);
assert(collor_i[0] <= 1 && collor_i[1] <= 1 && collor_i[2] <= 1);
collor = collor_i;
points = points_i;
}
vec3 shape::getCollor() {
return collor;
}
std::list<vec3>* shape::getPoints() {
return &points;
}
void shape::setCollor(vec3 collor_i) {
collor = collor_i;
}
void shape::setPoints(std::list<vec3>& points_i) {
points = points_i;
};