【问题标题】:Assimp Sample giving errorsAssimp Sample 给出错误
【发布时间】:2013-04-18 02:29:07
【问题描述】:

我刚刚得到了最后一个assimp SDK,并做了一个项目,我正确地链接了它(链接没有错误)但是我似乎对示例项目有些麻烦。更具体地说,SimpleOpenGL 之一。 我正在使用 C++ 结合 OpenGL 和 Visual Studio 10。

struct aiVector3D scene_min, scene_max, scene_center;

上面的行会产生以下错误。

1>main.cpp(25): error C2371: 'aiVector3D' : redefinition; different basic types
1>d:\libraries\assimp--3.0.1270-sdk\include\assimp\vector3.h(124) : see declaration of 'aiVector3D'
1>main.cpp(25): error C2079: 'scene_min' uses undefined struct 'aiVector3D'
1>main.cpp(25): error C2079: 'scene_max' uses undefined struct 'aiVector3D'
1>main.cpp(25): error C2079: 'scene_center' uses undefined struct 'aiVector3D'

还有更多错误,但如果在我解决这个问题后仍然出现,我会发布它们。

因评论而编辑

看起来可行!谢谢。但是你能解释一下为什么 struct 这个词不会影响 C 语言的程序吗?

【问题讨论】:

  • 我在一个答案中总结了我的 cmets :)

标签: c++ opengl assimp


【解决方案1】:

您必须从定义中删除 struct 这个词,因为 aiVector3D 的声明方式不同 in the header file

在链接的头文件中,您会看到 #ifdef __cplusplus 行,预处理器将其用于条件编译。这意味着如果您使用 C++ 编译器,直到下一个 #else 之前的所有内容都将被编译到目标文件中。这段代码告诉我们 aiVector3D 是 aiVector3t<float> 的 typedef(= 其他名称)。

如果你使用纯 C 编译器,则 aiVector3D 的声明是

struct aiVector3D {
    float x,y,z;
}

这符合你的定义。

【讨论】:

  • Thnx 很多 :) 没有仔细查看那些文件 :(
猜你喜欢
  • 1970-01-01
  • 2018-03-28
  • 2014-06-23
  • 2015-06-28
  • 2013-04-11
  • 2019-03-25
  • 2019-01-11
  • 2017-01-11
  • 2013-05-01
相关资源
最近更新 更多