gpt4 book ai didi

c++ - 子弹物理,Visual Studio 中的链接错误

转载 作者:IT老高 更新时间:2023-10-28 22:36:51 25 4
gpt4 key购买 nike

我在 Windows 7 和 Visual Studio 2012 上使用 Bullet Physics。我已经编译了库,并且演示工作正常,但是当我尝试创建自己的解决方案时,出现链接错误。我已将代码量降到最低

#include "btBulletDynamicsCommon.h"
int main(int argc, char*argv[])
{
btBoxShape* box = new btBoxShape(btVector3(1, 1, 1));
return 0;
}

当我链接时,使用 Visual Studio 会出现以下错误:

1>------ Build started: Project: HelloBulletApp, Configuration: Release Win32 ------  
1> main.cpp
1> main.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>BulletCollision.lib(btCollisionShape.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.obj
1>BulletCollision.lib(btConvexShape.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.obj
1>BulletCollision.lib(btPolyhedralConvexShape.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.obj
1>BulletCollision.lib(btConvexPolyhedron.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.obj
1>LinearMath.lib(btConvexHullComputer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.obj
1>LinearMath.lib(btGeometryUtil.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in main.obj
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>c:\path\to\HelloBulletApp\HelloBulletApp\Release\HelloBulletApp.exe : fatal error LNK1319: 6 mismatches detected

在调试或 Release模式下构建时出现相同的错误。我试过了:
- 重建子弹 2.81,
- 重新下载2.81,
- 创建一个空白项目并添加库,
- 创建一个空白项目并按照 http://bulletphysics.org/mediawiki-1.5.8/index.php/Creating_a_project_from_scratch 中的建议添加项目,但无济于事。

有什么我可以做的吗?

最佳答案

看起来 BulletCollision.lib 已编译为与 C 运行时库 (/MD) 的 DLL 版本链接,但您正在编译为与静态链接的运行时库 (/MT) 链接。更改编译器选项以链接 DLL 运行时库。

关于c++ - 子弹物理,Visual Studio 中的链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13444816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com