Trouble setting up Bullet Physics in Visual Studio 2015

Post Reply
Atreus
Posts: 5
Joined: Fri Aug 19, 2016 7:01 pm

Trouble setting up Bullet Physics in Visual Studio 2015

Post by Atreus »

I am having trouble setting up bullet physics in visual studio 2015.
The procedure mentioned in the official documentation and this link [ http://www.bulletphysics.org/mediawiki- ... om_scratch] are not working for me.
I need help setting up the bullet physics in visual studio so I can write some programs using it, if possible please mention all the required steps in detail.
anthrax11
Posts: 72
Joined: Wed Feb 24, 2010 9:49 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by anthrax11 »

What problem are you having?
rebirth
Posts: 24
Joined: Thu Jul 24, 2014 2:48 am

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by rebirth »

Bullet is pretty much straight forward for setting up. However, you will probably need to use CMake to create the build for VS2015. Just run CMake, set the directories to the root directory of Bullet, configure and create. After that you just open the project CMake created and build your debug and release libraries (static out of the box).

P.S. If you're not sure which checkboxes to use when configuring with CMake, then start with the defaults (you shouldn't have any problems). If, like me, you'd prefer a minimalist build then uncheck all the 'demos' and keep only what you want. If you don't want to use GPU physics, then uncheck Bullet3 etc etc. That's about all that is specific to Bullet.
Atreus
Posts: 5
Joined: Fri Aug 19, 2016 7:01 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by Atreus »

Thanks for the reply guys, really appreciate it :) ,the trouble I'm facing is to get the bullet physics up and running with visual studio.
I am not new to programming, but building source code is an alien territory for me. I just want to get bullet physics up and running and start programming.
I have tried many times to build source code and was successful in creating bulletSoftBody, bulletDynamics, bulletCollision, linear math library files, but I'm facing difficulty in setting up a project for bullet physics in visual studio 2015. The methods mentioned in the manual and the link
[ http://www.bulletphysics.org/mediawiki- ... om_scratch] are not working for me. Can anyone provide detailed instructions or sadly I will be stuck forever,please.
Atreus
Posts: 5
Joined: Fri Aug 19, 2016 7:01 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by Atreus »

These are the errors I'm getting when I follow the instructions on this link [ http://www.bulletphysics.org/mediawiki- ... om_scratch ].

Please refer to the attached images.
Attachments
error2.png
error2.png (256.68 KiB) Viewed 30715 times
error1.png
error1.png (265.71 KiB) Viewed 30715 times
anthrax11
Posts: 72
Joined: Wed Feb 24, 2010 9:49 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by anthrax11 »

Looks like a linker error, so make sure you added BulletCollision, BulletDynamics and LinearMath to your solution and added a reference from the test app to all three of them. Also check that you didn't use Bullet3Collision or Bullet3Dynamics.
Atreus
Posts: 5
Joined: Fri Aug 19, 2016 7:01 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by Atreus »

I tried again but it shows these errors now.
Attachments
error4.png
error4.png (173.65 KiB) Viewed 30649 times
error3.png
error3.png (156.91 KiB) Viewed 30649 times
anthrax11
Posts: 72
Joined: Wed Feb 24, 2010 9:49 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by anthrax11 »

That's the part in the tutorial about the C++ runtime library.

The linker is trying to link together the application (BulletTest.obj) and the three files from Bullet (BulletCollision.lib, BulletDynamics.lib, LinearMath.lib). Since USE_MSVC_RUNTIME_LIBRARY_DLL is not specified, the Bullet libraries request the linker to link statically against the C++ runtime library, meaning functions from the C++ library would be included in the application's .exe file. Meanwhile the application itself (the BulletTest project) wants to dynamically link against the C++ runtime library by default, meaning that the application would have an external dependency on msvcrXXX.dll.

The error occurs because the four modules cannot link to the C++ runtime library both statically and dynamically. They must all use the same setting in order to be linked together.

I wonder if the default runtime library settings have changed for new C++ projects in Visual Studio and the tutorial became incomplete? Anyway, the tutorial should either suggest to:
1) link C++ dynamically: set USE_MSVC_RUNTIME_LIBRARY_DLL or
2) link C++ statically: go to the application's Project Properties -> C/C++ -> Code Generation -> Runtime Library and set it to Multi-threaded (/MT) (or Multi-threaded Debug (/MTd) depending on the configuration).

I hope this makes sense. If not, you can just set USE_MSVC_RUNTIME_LIBRARY_DLL. :)
Atreus
Posts: 5
Joined: Fri Aug 19, 2016 7:01 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by Atreus »

Thanks for replying:)

Talk about timing,before you posted your reply I was just able to figure out the issue haha, yes I checked the USE_MSVC_RUNTIME_LIBRARY_DLL option in cmake and it worked(it was the issue of dynamic and static runtime library I guess).

Anyways thanks for all the pain you took in helping me, have a good day!!
anthrax11
Posts: 72
Joined: Wed Feb 24, 2010 9:49 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by anthrax11 »

I added this info to the tutorial. It should be useful for others as well.
Alex_K
Posts: 1
Joined: Sun Sep 18, 2016 7:59 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by Alex_K »

Atreus wrote:...I checked the USE_MSVC_RUNTIME_LIBRARY_DLL option in cmake and it worked...
You could simply go to project settings in Visual Studio and under "C++ / Code Generation" menu, set 'Runtime Library' option to 'xxx DLL'.
I'm new to all this things and had a few days of nightmare trying to figure out what am I doing wrong. :)
hyyou
Posts: 96
Joined: Wed Mar 16, 2016 10:11 am

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by hyyou »

As a reference, this is the page Anthrax11 mentioned (thank for editing it) :-
http://bulletphysics.org/mediawiki-1.5. ... om_scratch
mister345
Posts: 2
Joined: Thu Dec 14, 2017 2:18 pm

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by mister345 »

So after I "build" the project with cmake, how do I link the dlls or lib files produced by the build to my actual C++ project to be able to use it in my game? After it built, I looked inside the Bullet\bullet3\bin directory (where I told cmake to put the built files), and I didnt see a lib or include folder like you normally do when including / linking libraries inside a visual studio project. Also, there were no .lib or .dll files produced by cmake, only a ton of individual "cmake" folders with nothing inside of them. I just want to build teh standard Bullet libraries and link em to my C++ game engine so I can start coding. Can anyone please help? The documentation doesnt tell you any of these details. Thanks.
Vitulus
Posts: 5
Joined: Thu Dec 20, 2018 10:55 am

Re: Trouble setting up Bullet Physics in Visual Studio 2015

Post by Vitulus »

I was stuck like mister345, I thought that it came with some DLL files. However, once you have compiled using CMAKE, you must open the project and compile it. After this, a lib folder will appear which you can use instead.
Post Reply