【问题标题】:BulletPhysics: Error LNK2001: unresolved external symbol [duplicate]BulletPhysics:错误 LNK2001:无法解析的外部符号 [重复]
【发布时间】:2015-06-09 20:51:33
【问题描述】:

我尝试完成this tutorial 以创建一个带有子弹物理的测试应用程序。我遵循每一步,没有改变任何其他东西。操作系统是 Windows 8.1(64 位),Visual Studio 2013。当我尝试调试或发布时,我收到以下错误:

BulletTestApp.cpp

#include "stdafx.h"
#include "btBulletDynamicsCommon.h"

int _tmain(int argc, _TCHAR* argv[])
{
btBoxShape* box = new btBoxShape(btVector3(1, 1, 1));
return 0;
}

调试

1>BulletTestApp.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void * __cdecl btAlignedAllocInternal(unsigned int,int)" (?btAlignedAllocInternal@@YAPAXIH@Z)" in Funktion ""public: static void * __cdecl btBoxShape::operator new(unsigned int)" (??2btBoxShape@@SAPAXI@Z)".
1>BulletTestApp.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl btAlignedFreeInternal(void *)" (?btAlignedFreeInternal@@YAXPAX@Z)" in Funktion ""public: static void __cdecl btBoxShape::operator delete(void *)" (??3btBoxShape@@SAXPAX@Z)".
1>BulletTestApp.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall btBoxShape::btBoxShape(class btVector3 const &)" (??0btBoxShape@@QAE@ABVbtVector3@@@Z)" in Funktion "_wmain".

发布

1>BulletTestApp.obj : error LNK2001: Nicht aufgelöstes externes Symbol     ""void * __cdecl btAlignedAllocInternal(unsigned int,int)" (?btAlignedAllocInternal@@YAPAXIH@Z)".
1>BulletTestApp.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""void __cdecl btAlignedFreeInternal(void *)" (?btAlignedFreeInternal@@YAXPAX@Z)".
1>BulletTestApp.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: __thiscall btBoxShape::btBoxShape(class btVector3 const &)" (??0btBoxShape@@QAE@ABVbtVector3@@@Z)"

而“Nicht aufgelöstes externes Symbol”是“未解析的外部符号”。我该如何解决这个问题?

【问题讨论】:

    标签: c++ lnk2019 unresolved-external bulletphysics lnk2001


    【解决方案1】:

    此错误表示在标头中找到函数(例如 btAlignedAllocInternal(...) ),但未找到实现(源代码)。您需要实现此功能的.lib 或.dll(或者可能是.cpp 文件)。此文件必须位于项目已知的文件夹中。链接器找不到这些文件,因此出现链接器错误。 以下帖子可能会有所帮助:How to link a DLL in Visual Studio

    编辑:您应该尝试正确包含所有配置的随附的 Visual Studio 项目:...\bullet-2.81-rev2613\build\vs2010。 VS 2013 自动将其导入到较新的版本。

    【讨论】:

    • 除了添加子弹库的生成项目文件外,.lib文件也必须包含到我自己的项目中。感谢您的提示!
    猜你喜欢
    • 2011-09-29
    • 2011-05-06
    • 1970-01-01
    • 1970-01-01
    • 2013-09-11
    • 2022-01-07
    • 2018-10-28
    • 1970-01-01
    • 2010-11-17
    相关资源
    最近更新 更多