g++ can't find bullet in ubuntu + vckpg install

Post Reply
jinprelude
Posts: 2
Joined: Mon Aug 23, 2021 3:10 am

g++ can't find bullet in ubuntu + vckpg install

Post by jinprelude »

Hi! I'm the beginner who's trying to use bullet in c++ environment.

I set my environment in Ubuntu 20.04 and g++ 9.3.0, and successfully installed bullet using vcpkg by following official vcpkg instruction(https://github.com/bulletphysics/bullet ... sing-vcpkg)
And then when I tried to build helloworld example code(https://github.com/bulletphysics/bullet ... oWorld.cpp) using g++ like below, it raised the error:

Code: Select all

> g++ opengl_example.cpp
opengl_test.cpp:15:10: fatal error: btBulletDynamicsCommon.h: No such file or directory
   15 | #include "btBulletDynamicsCommon.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
I also tried adding absolute path of the bullet by following command but it also failed:

Code: Select all

> g++ opengl_example.cpp  -I/home/jinprelude/Downloads/vcpkg/installed/x64-linux/include/bullet
/usr/bin/ld: /tmp/ccqWeDL6.o: in function `main':
opengl_test.cpp:(.text+0x58): undefined reference to `btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(btDefaultCollisionConstructionInfo const&)
Same erorr was also raised in Ubuntu 18.04, and the second trial which I mentioned was executed today right after the ubuntu 20.04 finished the installation.

Has anyone experienced a problem like this? Any kinds of replies are welcome!
And please let me know if there are any instances in this article that violate the rules of the forum. I'll fix it and upload it again.
Thanks for your time!

Best regards
jinprelude
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: g++ can't find bullet in ubuntu + vckpg install

Post by drleviathan »

What do you really want to do? If you just want to build Bullet C++ then I would recommend copying build_cmake_pybullet_double.sh to build_cmake.sh and then modifying that script to only build the parts you want.

If vcpkg is important to the process then... I dunno. Maybe someone else here knows.
jinprelude
Posts: 2
Joined: Mon Aug 23, 2021 3:10 am

Re: g++ can't find bullet in ubuntu + vckpg install

Post by jinprelude »

drleviathan wrote: Mon Aug 23, 2021 3:03 pm What do you really want to do? If you just want to build Bullet C++ then I would recommend copying build_cmake_pybullet_double.sh to build_cmake.sh and then modifying that script to only build the parts you want.

If vcpkg is important to the process then... I dunno. Maybe someone else here knows.
Thanks for your reply! I tried building Bullet using cmake, but same error occured..
One think I newly figured out is that both cmake and vcpkg build successfully find "bullet/btBulletDynamicsCommon.h" when I add "bullet/" in front of "btBulletDynamicsCommon.h" but another error occured:

Code: Select all

> g++ opengl_example.cpp 
In file included from /usr/local/include/bullet/btBulletCollisionCommon.h:22,
                 from /usr/local/include/bullet/btBulletDynamicsCommon.h:20,
                 from opengl_example.cpp:1:
/usr/local/include/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h:77:10: fatal error: LinearMath/btVector3.h: No such file or directory
   77 | #include "LinearMath/btVector3.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
+ bullet version : 3-3.17
Both vcpkg installation guide I tried and cmake installation guide you told me is the official guideline, I think this problem is not for anyone, but just for my computer setting, or I'm missing something. I couldn't find solution yet, so if i find the solution I'll leave it reply. Thanks again drleviathan!
Post Reply