C++glm::混合错误



我有这行代码和以下库

  • gl\glew.h
  • gl\gl.h
  • gl\glu.h
  • gl\wglew.h
  • glm/glm.hpp
  • glm/gtc/matrix_transform.hpp
  • glm/gtc/matrix_transform.hpp
  • glm/gtc/type_ptr.hpp
  • glm/gtx/transform.hpp
  • glm/gtc/四元数.hpp
  • glm/gtx/四元数.hpp
  • glm/gtx/compatibility.hpp

Orientation属性为glm::mat4,而fInterpolate为浮点值。

finalJoint.Orientation = glm::mix(joint0.Orientation, joint1.Orientation, fInterpolate);

导致此错误

错误3错误LNK2019:未解析的外部符号"结构glm::detail::tmat4x4__cdecl glm:,mix,float>(结构glm:const&,结构体glm::detail::tmat4x4 const&,浮点常量&)"($mix@U$tmat4x4@M@detail@glm@@M@glm@@YA?AU$tmat4x4@M@detail@0@ABU120@0ABM@Z)在函数"public:void __thiscall"中引用saragan::cSaraganMesh::InterpolateMesh(struct keyFrame,structkeyFrame,float)"(?InterpolateMesh@cSaraganMesh@saragan@@QAEXUkeyFrame@@0M@Z)D:\git\DestBed\TestBed\ObjLoader.lib(cSaraganMesh.obj)TestBed

我试过使用glm:quat,但我得到了相同的错误;我在另一个项目中使用了它,但找不到区别,相同的库和预处理器的顺序相同?

您的include文件可能不在同一目录中?

通常,对于未解决的外部符号错误,您可以将标头中的变量声明为:

extern int x;

然后在cpp文件中定义它。

有趣的是,当再次使用quats时,我的问题消失了。。。。我认为使用mat4和混合时有一些有趣的地方

glm::quat joint0Orientation = glm::toQuat(joint0.Orientation);
glm::quat joint1Orientation = glm::toQuat(joint1.Orientation);
glm::quat Final = glm::mix(joint0Orientation, joint1Orientation, fInterpolate);
finalJoint.Orientation = glm::toMat4(Final);

以上内容似乎解决了我的问题,尽管它很有效,但有人能看到最初问题的原因吗?或者怀疑问题出在哪里只是为了澄清?

最新更新