[VS试图使用Bullet物理库的lvl2001错误

问题描述 投票:-1回答:1

我是C ++,Visual Studio(2019)和Bullet(2.89)的新手。在过去的几天里,我一直在尝试从Bullet构建Hello_World.cpp,但我一直陷在这5个链接错误中:

1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::getBoundingSphere(class btVector3 &,float &)const " (?getBoundingSphere@btCollisionShape@@UBEXAAVbtVector3@@AAM@Z)
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getAngularMotionDisc(void)const " (?getAngularMotionDisc@btCollisionShape@@UBEMXZ)
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getContactBreakingThreshold(float)const " (?getContactBreakingThreshold@btCollisionShape@@UBEMM@Z)
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexShape::project(class btTransform const &,class btVector3 const &,float &,float &,class btVector3 &,class btVector3 &)const " (?project@btConvexShape@@UBEXABVbtTransform@@ABVbtVector3@@AAM2AAV3@3@Z)
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btSphereShape::calculateLocalInertia(float,class btVector3 &)const " (?calculateLocalInertia@btSphereShape@@UBEXMAAVbtVector3@@@Z)

[还有其他人遇到此问题或类似问题,但没有答案或对我不起作用。

设置:

  • 我使用了premake来设置VS解决方案,Bullet是在静态库中组织的(作为具有被编译为lib文件的源代码的项目,现在我试图将它们与应用程序项目链接。
  • 所有项目都使用静态链接(用于调试)。
  • 我已将所有项目符号项目引用到我的项目中。
  • 我什至从子弹静态链接到lib文件(并且链接器显然可以看到这些文件,我什至尝试提供绝对路径)
  • 据我所知,这些函数存在并且在.cpp和.h文件中具有相同的签名

如果您需要更多详细信息,请告诉我。

((我可能得到的一个线索是关于不同的bt_double_precision的东西?但是那可能不是,唯一能想到的就是我使用不同的精度的浮点模型。但是使之无所作为)

提前感谢!

编辑:我认为此答案不适用于我

What is an undefined reference/unresolved external symbol error and how do I fix it?

编辑:也许值得一提:该项目的文件结构确实很奇怪(由premake决定):

  • 解决方案和项目文件在:bullet3-2.89 \ build3 \ vs2010
  • 高级头文件(Hello_World使用的头文件包括其他头文件:bullet3-2.89 \ src
  • 源文件和头文件是bullet3-2.89 \ src的子目录
  • 库:bullet3-2.89 \ bin但所有标头在其包含中均使用正确的相对路径,并且我已将项目的包含和库目录设置为这些位置
c++ static-linking bullet lnk2001
1个回答
0
投票

我找到了解决方法。只是要劫持Bullet的示例项目之一,而是改用它。他们在VS设置上似乎比我更好:D无论如何,谢谢您的建议。

© www.soinside.com 2019 - 2024. All rights reserved.