【问题标题】:How to solve the glm label redefined error [closed]如何解决glm标签重新定义错误[关闭]
【发布时间】:2020-10-21 17:51:20
【问题描述】:

我有以下代码来旋转一个对象。

glm:vec3 myRotationAxis(1.0f, 1.0f, 0.0f);
  glm:mat4 rot = glm::rotate(glm::mat4(1.0), 3.14f, myRotationAxis);

为什么它会给我 glm label redefined 错误?

【问题讨论】:

  • 你的代码有错别字:glm:vec3,glm:mat4

标签: c++ opengl glm-math


【解决方案1】:

您使用的是冒号,而您应该使用范围解析运算符:::。 a::b 表示在 a 范围内查找符号 b。在您的情况下,符号是类,范围是由 glm 库定义的 glm 命名空间。改为写:

glm::vec3 myRotationAxis(1.0f, 1.0f, 0.0f);
  glm::mat4 rot = glm::rotate(glm::mat4(1.0), 3.14f, myRotationAxis);

在您提供的代码中,单冒号定义了一个标签“glm”,但它执行了两次,导致错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-19
    • 2015-03-23
    相关资源
    最近更新 更多