btCollisionShape unresolved externals

Post Reply
BetMora
Posts: 2
Joined: Fri Jan 10, 2014 5:42 pm

btCollisionShape unresolved externals

Post by BetMora »

Hello dear forum members.
Currently trying to compile https://bitbucket.org/sirbrialliance/raytrace this OpenCL raytracer which uses Bullet for some simple physics. As i understand raytracer itself was tested under Linux only. But it's really simply to compile it under Windows, it's successfully running and displays image, but currently static only, as i didn't manage to compile it with Bullet code. All the code which is using Bullet located in one file: https://bitbucket.org/sirbrialliance/ra ... at=default
Errors i'm getting are these:

Code: Select all

1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::getBoundingSphere(class btVector3 &,double &)const " (?getBoundingSphere@btCollisionShape@@UBEXAAVbtVector3@@AAN@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall btCollisionShape::getAngularMotionDisc(void)const " (?getAngularMotionDisc@btCollisionShape@@UBENXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall btCollisionShape::getContactBreakingThreshold(double)const " (?getContactBreakingThreshold@btCollisionShape@@UBENN@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btSphereShape::calculateLocalInertia(double,class btVector3 &)const " (?calculateLocalInertia@btSphereShape@@UBEXNAAVbtVector3@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexShape::project(class btTransform const &,class btVector3 const &,double &,double &)const " (?project@btConvexShape@@UBEXABVbtTransform@@ABVbtVector3@@AAN2@Z)
Compiling under VS2010 with Bullet 2.82-r2704. BulletDynamics, BulletCollision and LinearMath libraries are being linked.
I've been googling that problem for a while already, didn't manage to find at least one "solution" that was able to help me..
Hope for your help guys, thanks in advance.
bwelch
Posts: 48
Joined: Thu Dec 12, 2013 4:04 pm

Re: btCollisionShape unresolved externals

Post by bwelch »

I've seen these errors a bunch while trying to integrate Bullet with some other code. Such a headache (especially since I've never dealt with MSVS until this project!). From my understanding, this occurs when you include a .h file that has a function prototype but the corresponding definition (usually in a .cpp) isn't included. When this happened to me, the problem was ALWAYS a problem with adding the .lib files. Either I typed them in wrong, got the filepath wrong, didn't hit Apply, or added them in release but not debug or vice versa. I don't know your comfort with MSVS, but you should be looking at the location in the attached screenshot (your filepaths may vary). Right-click on your project > Properties > Linker > Input.

If you've checked these things and that's not the problem, then it's probably something out of my league. Good luck.
Attachments
libs.jpg
libs.jpg (165.94 KiB) Viewed 7744 times
BetMora
Posts: 2
Joined: Fri Jan 10, 2014 5:42 pm

Re: btCollisionShape unresolved externals

Post by BetMora »

No no, libraries path is correct and libraries are being linked, as i told. Thank you for your help, anyway :)
So i tried removing libraries linking at all yesterday and simply included needed .cpp files(as such - btCollisionShape.cpp and few other collision shapes), got rid of the externals i've shown in the first message but got lots more of another unresolved externals, as i didn't include other files. Still have no idea why linker refuses to find symbols inside lib.
Little update: got it compiled, included following .cpp files to the project: btCollisionShape.cpp, btConvexShape.cpp, btSphereShape.cpp, btConvexInternalShape.cpp, btCollisionObject.cpp.
Currently does not actually work as intended, putting bullet code back to check if it does.
Still, it's not a real solution, just a dirt hack.
Another update: had to include whole bullet collisions and dynamics sources.. after all getting that error:

Code: Select all

btPolyhedralConvexShape.obj : error LNK2019: unresolved external symbol "private: double __thiscall btConvexHullComputer::compute(void const *,bool,int,int,double,double)" (?compute@btConvexHullComputer@@AAENPBX_NHHNN@Z) referenced in function "public: double __thiscall btConvexHullComputer::compute(double const *,int,int,double,double)" (?compute@btConvexHullComputer@@QAENPBNHHNN@Z)
That's pretty weird.
yluo
Posts: 8
Joined: Tue Sep 25, 2018 9:31 pm

Re: btCollisionShape unresolved externals

Post by yluo »

Hi did you solve it? My visual studio also refuses to link the symbols lib as it is supposed to.
maximus57
Posts: 1
Joined: Fri Sep 02, 2022 3:35 pm

Re: btCollisionShape unresolved externals

Post by maximus57 »

If You set USE_DOUBLE_PRECISION in cmake configuration, You also need to set compile difinition in your application:
BT_USE_DOUBLE_PRECISION=1
Example cmake:

Code: Select all

target_compile_definitions(${PROJECT_NAME} PRIVATE BT_USE_DOUBLE_PRECISION=1)
https://stackoverflow.com/questions/548 ... hysics-sdk
Post Reply