2

嘿,所以我刚刚下载了子弹 2.78,并采取了以下步骤:

  • 解压后找到了这个教程

  • 完全按照 Cmake 的步骤进行操作,除了我发现教程中的图片检查了一些东西,比如安装库,我没有,所以我最终检查了所有可能的东西。

  • 进入新生成的 BULLET_PHYSICS.vcxproj 并在 debug 和 release 下构建

  • 看到我在 msvn/BulletBuild/lib 的 lib 文件夹中有一堆新的库,但对它们什么也没做

  • 完全按照教程中的其余步骤设置实际项目

  • 试图构建最后一行代码:FAIL

  • 想知道我是否需要 dll,因为只有 .libs 和 pdbs 出现在 lib 文件夹中,并且教程没有提到 em

我重建库的唯一经验是通过 SFML 构建下载中包含的 msvn 文件并使用生成的动态 lib 和 dll 文件。然而,本教程中的说明非常不同。(如果有人可以向我解释这是如何工作的,那就太好了)

我多次完全按照说明进行操作,但我不确定我错过了什么。如果我注释掉 main 中的代码行但保留包含,则构建工作,但是当我保留它时,我得到这个:

    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "void * __cdecl btAlignedAllocInternal(unsigned int,int)" (?btAlignedAllocInternal@@YAPAXIH@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "void __cdecl btAlignedFreeInternal(void *)" (?btAlignedFreeInternal@@YAXPAX@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexInternalShape::getAabbSlow(class btTransform const &,class btVector3 &,class btVector3 &)const " (?getAabbSlow@btConvexInternalShape@@UBEXABVbtTransform@@AAVbtVector3@@1@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall btCollisionShape::serialize(void *,class btSerializer *)const " (?serialize@btCollisionShape@@UBEPBDPAXPAVbtSerializer@@@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: __thiscall btPolyhedralConvexShape::btPolyhedralConvexShape(void)" (??0btPolyhedralConvexShape@@QAE@XZ)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall btPolyhedralConvexShape::~btPolyhedralConvexShape(void)" (??1btPolyhedralConvexShape@@UAE@XZ)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexInternalShape::setLocalScaling(class btVector3 const &)" (?setLocalScaling@btConvexInternalShape@@UAEXABVbtVector3@@@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::getBoundingSphere(class btVector3 &,float &)const " (?getBoundingSphere@btCollisionShape@@UBEXAAVbtVector3@@AAM@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getAngularMotionDisc(void)const " (?getAngularMotionDisc@btCollisionShape@@UBEMXZ)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getContactBreakingThreshold(float)const " (?getContactBreakingThreshold@btCollisionShape@@UBEMM@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::serializeSingleShape(class btSerializer *)const " (?serializeSingleShape@btCollisionShape@@UBEXPAVbtSerializer@@@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btBoxShape::getAabb(class btTransform const &,class btVector3 &,class btVector3 &)const " (?getAabb@btBoxShape@@UBEXABVbtTransform@@AAVbtVector3@@1@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btBoxShape::calculateLocalInertia(float,class btVector3 &)const " (?calculateLocalInertia@btBoxShape@@UBEXMAAVbtVector3@@@Z)
    1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall btPolyhedralConvexShape::initializePolyhedralFeatures(void)" (?initializePolyhedralFeatures@btPolyhedralConvexShape@@UAE_NXZ)
    1>C:\Libraries and Headers\Bullet\bullet-2.78\msvc\BulletTestApp\Release\BulletTestApp.exe : fatal error LNK1120: 14 unresolved externals

我知道某处存在链接问题,但我完全按照说明进行操作,所以我不知道如何解决它。在查看添加项目的属性时,我看不到任何额外的依赖关系,如果这不是它应该是的样子......但我想我首先不理解这种使用库的方法,所以知识有助于。

4

1 回答 1

4

好吧,显然右键单击我的 TestBulletApp 项目并单击“项目依赖项”是我出错的地方。msVS++ 2010 出于某种原因将选项留在那里,即使
那样做是行不通的

为了使项目依赖于解决方案中的其他项目,您必须右键单击您的项目,例如我的“TestBulletApp”,然后转到“属性”->“通用属性”->“框架和引用”->“添加新引用”并添加依赖静态库项目已添加到解决方案中,例如“bulletCollision”或其他;还要检查右侧的“链接库依赖项”是否为真。

所以是的,谢谢你的提醒......'咳嗽''咳嗽'=)

于 2011-06-30T07:06:51.713 回答