c++ - BulletPhysics:错误 LNK2001:未解析的外部符号

标签 c++ lnk2019 unresolved-external bulletphysics lnk2001

<分区>

我试图完成 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”是“未解析的外部符号”。我该如何解决这个问题?

最佳答案

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

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

关于c++ - BulletPhysics:错误 LNK2001:未解析的外部符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30742593/

相关文章:

c++ - 模板化二叉搜索树 C++, Unresolved external 错误

c++ - 非常简单的c++程序中的lnk2019错误

c++ - LNK2019 Unresolved external symbol 错误

c++ - 尝试针对旧的 STD 库和 Windows SDK 进行编译时出现链接错误

c++ - 我们如何确定我们的程序运行良好?

c# - DLLimport 无法加载 dll

c++ - casting operator() - 转换为引用并转换为值

c++ - VC++ Express 2008 中的错误 LNK2019 和 LNK2028

C++数据结构声明

c++ - 什么是 undefined reference /未解析的外部符号错误,我该如何解决?