VS 2015 Linker Error

Post Reply
torpo
Posts: 2
Joined: Wed May 27, 2020 3:33 am

VS 2015 Linker Error

Post by torpo »

Hi

I've downloaded bullet version 2.88 and used the batch file (build_visual_studio_without_pybullet_vr) after changing vs2010 to vs2015 and also needed to change the premake4.lua file in bullet3-2.88\test\GwenOpenGLTest because I received this error; Error: invalid value 'Unicode' for flags

I could then open the 0_Bullet3Solution solution in VS 2015 and build it. I could run the Examples Browser as well.

Next I wanted to create my own project. So, I would create a New Project (Win 32 Console Application) and write a minimal code as below:
#include "stdafx.h"
#include "stdafx.h"
#include "btBulletDynamicsCommon.h"
int _tmain(int argc, _TCHAR* argv[]) {
btBoxShape * box = new btBoxShape(btVector3(1, 1, 1));
delete box;
return 0;
}

To add libraries, I do the following three steps:
1. Right click the Solution>Add Existing Project and select BulletDynamics, Bullet3Collision and LinearMath and then for my project right click on References>Add Reference and select the three of them
2. Right click my project>Properties and in Configuration Properties>C/C++>General>Additional Include Directories>bullet3-2.88\src directory is added (I've made sure All Configurations option is selected)
3. Right click my project>Properties and in Configuration Properties>Linker>Input>Additional Dependencies>BulletDynamics.lib, LinearMath.lib and Bullet3Collision.lib are added with absolute path (I've made sure All Configurations option is selected)

When I try to build it (release) in VS 2015, I get the following error which I know is a linker error but I don't know how to resolve it:
Error LNK2001 unresolved external symbol "public: __thiscall btBoxShape::btBoxShape(class btVector3 const &)" (??0btBoxShape@@QAE@ABVbtVector3@@@Z)

Any guidance on possible source of problem is appreciated.
torpo
Posts: 2
Joined: Wed May 27, 2020 3:33 am

Re: VS 2015 Linker Error

Post by torpo »

Okay I figured it out. I am not very familiar with VS and I thought I would share where the problem was and how I resolved the error maybe someone finds this helpful.

So first I changed the references to BulletCollision not Bullet3Collision and when I did, I got a new link error like this:
LNK2038 mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug'

As the error shows, it's a "Runtime Library" error which happens because of the different settings in how the library was built (collision, dynamics and linear math) and how the code is built. To resolve this issue, you need to check this setting in the libraries. To do this, right click on the project (BulletCollision for example) and click Properties>Configuration Properties>C/C++>Code Generation>Runtime Library and note it (for me it was /MTd) and to save you some hassle you might see something link "different options" if your Configuration in the top left of the window is set to All Configurations. You need to change it to Debug or Release to get the specific value.
Now go to your project and do the same till you get the Runtime Library and make sure it's exactly the same. No more errors and code builds successfully.
Post Reply