预期的说明符限定符列表位于“b3Vec”之前

发布于 2024-10-08 03:34:47 字数 590 浏览 0 评论 0原文

这应该是一个简单的问题,但我无法弄清楚问题所在。

我有一个在 3D 空间中定义向量的结构,在 vectors.h 中:

/**
 * The struct defining vectors in 3D space.
 */
struct b3Vec {

  /**
   * The size of the vector.
   */
  double size;

  /**
   * The first direction of the vector in degrees.
   */
  double dir1;

  /**
   * The second direction of the vector in degrees.
   */
  double dir2;
};

在另一个结构中,在 world.h 中称为 b3World 我有这个:

b3Vec gravitation;

我收到错误在此行“b3Vec”之前的预期说明符限定符列表。我正确地包含了头文件,这是我得到的唯一错误。

谁能帮助我吗?

This should be a simple one, but I can't figure out the problem.

I have a struct defining a vector in 3D space, in vectors.h:

/**
 * The struct defining vectors in 3D space.
 */
struct b3Vec {

  /**
   * The size of the vector.
   */
  double size;

  /**
   * The first direction of the vector in degrees.
   */
  double dir1;

  /**
   * The second direction of the vector in degrees.
   */
  double dir2;
};

In another struct, called b3World in world.h I have this:

b3Vec gravitation;

I'm getting the error on this line Expected specifier-qualifier-list before 'b3Vec'. I'm including the header files right and it's the only error I get.

Can anyone help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九公里浅绿 2024-10-15 03:34:47

您需要使用 struct 关键字:

struct b3Vec gravitation;

You need to use the struct keyword:

struct b3Vec gravitation;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文