当我试图编译以下内容时,我会收到错误"Error 1 error C2143:语法错误:缺失';‘前面'*'“。有人知道我为什么会收到这个错误吗?我在这里做错什么了?
struct HE_edge {
HE_vert* vert; // vertex at the end of the half-edge<br>
HE_edge* pair; // oppositely oriented half-edge<br>
HE_face* face; // the incident face<br>
HE_edge* prev; // previous half-edge around the face<br>
HE_edge* next; // next half-edge around the face<br>
};
struct HE_vert {
float x, y, z; // the vertex coordinates<br>
HE_edge* edge; // one of the half-edges emanating from the vertex<br>
};
struct HE_face {
HE_edge* edge; // one of the half-edges bordering the face<br>
};发布于 2013-10-09 08:33:30
尝试按照正确的顺序声明您的结构:因为HE_edge依赖于HE_vert和HE_face,所以在前面声明它们。
struct HE_vert;
struct HE_face;
struct HE_edge {
HE_vert* vert; // vertex at the end of the half-edge<br>
HE_edge* pair; // oppositely oriented half-edge<br>
HE_face* face; // the incident face<br>
HE_edge* prev; // previous half-edge around the face<br>
HE_edge* next; // next half-edge around the face<br>
};
struct HE_vert {
float x, y, z; // the vertex coordinates<br>
HE_edge* edge; // one of the half-edges emanating from the vertex<br>
};
struct HE_face {
HE_edge* edge; // one of the half-edges bordering the face<br>
};发布于 2013-10-09 08:30:09
在使用HE_vert和HE_face之前,您需要转发声明它们。
// fwd declarations. Can use "struct" or "class" interchangeably.
struct HE_vert;
struct HE_face;
struct HE_edge { /* as before */ };发布于 2013-10-09 08:30:24
在使用类类型创建指针之前,需要声明所有类:
struct HE_edge;
struct HE_vert;
struct HE_face;
// your codehttps://stackoverflow.com/questions/19266713
复制相似问题