I'm using Bullet Physics, on Windows 7 and Visual Studio 2012. I have compiled the libraries, and the demos are working fine, but when I try to create my own solution, I am getting linking errors. I have minimised the amount of code to
#include "btBulletDynamicsCommon.h"
int main(int argc, char*argv[])
{
btBoxShape* box = new btBoxShape(btVector3(1, 1, 1));
return 0;
}
Which when I link, using Visual Studio gives me the following Errors:
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
The same errors are appearing when I build in Debug or Release Mode.
I've tried:
- rebuilding bullet 2.81,
- redownloading 2.81,
- creating a blank project and adding the libraries,
- creating a blank project and adding the Projects as suggested at http://bulletphysics.org/mediawiki-1.5.8/index.php/Creating_a_project_from_scratch,
but to no avail.
Is there anything I can do?
It looks like BulletCollision.lib was compiled to link with the DLL version of the C runtime library (/MD), but you're compiling to link with the statically linked runtime library (/MT). Change your compiler options to link with the DLL runtime library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With