C++ 结构 - 错误 1 ​​错误 C2143:语法错误:缺少“;"前 '*' [英] C++ Struct - Error 1 error C2143: syntax error : missing ';' before '*'

查看:45
本文介绍了C++ 结构 - 错误 1 ​​错误 C2143:语法错误:缺少“;"前 '*'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试编译以下内容时,收到错误错误 1 ​​错误 C2143:语法错误:缺少 ';'前 '*'".有谁知道我为什么会收到这个错误?我在这里做错了什么?

when i try to compile the following, i receive the error "Error 1 error C2143: syntax error : missing ';' before '*'". Does anyone know why am i receiving this error? What am i doing wrong here?

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>
};

推荐答案

尝试以正确的顺序声明您的结构:由于 HE_edge 依赖于 HE_vert 和 HE_face,所以先声明它们.

Try to declare your structs in the right order : Since HE_edge depends on HE_vert and HE_face, declare them before.

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>
};

这篇关于C++ 结构 - 错误 1 ​​错误 C2143:语法错误:缺少“;"前 '*'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆