Page 1 of 1

LNK2019 Error with Hello World

Posted: Wed Mar 15, 2017 12:45 pm
by Tearhead
Hey everyone. I'm new to Bullet and I'm trying to run the Hello world code found in the getting started section. I'm getting the following errors using Visual Studio 2017. I followed the installation guide, so not sure why it's not working. Thanks for any input

4>------ Build started: Project: BulletTestApp, Configuration: Debug Win32 ------
4>stdafx.cpp
4>BulletTestApp.cpp
4>c:\users\nick\desktop\bullet3-2.86.1\src\linearmath\btidebugdraw.h(169): warning C4305: 'argument': truncation from 'double' to 'const btScalar'
4>c:\users\nick\desktop\bullet3-2.86.1\src\linearmath\btidebugdraw.h(170): warning C4305: 'argument': truncation from 'double' to 'const btScalar'
4>c:\users\nick\desktop\bullet3-2.86.1\src\linearmath\btidebugdraw.h(171): warning C4305: 'argument': truncation from 'double' to 'const btScalar'
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: __thiscall btCollisionDispatcher::btCollisionDispatcher(class btCollisionConfiguration *)" (??0btCollisionDispatcher@@QAE@PAVbtCollisionConfiguration@@@Z) referenced in function _main
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::getBoundingSphere(class btVector3 &,float &)const " (?getBoundingSphere@btCollisionShape@@UBEXAAVbtVector3@@AAM@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getAngularMotionDisc(void)const " (?getAngularMotionDisc@btCollisionShape@@UBEMXZ)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getContactBreakingThreshold(float)const " (?getContactBreakingThreshold@btCollisionShape@@UBEMM@Z)
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: virtual char const * __thiscall btCollisionShape::serialize(void *,class btSerializer *)const " (?serialize@btCollisionShape@@UBEPBDPAXPAVbtSerializer@@@Z) referenced in function "public: virtual char const * __thiscall btConvexInternalShape::serialize(void *,class btSerializer *)const " (?serialize@btConvexInternalShape@@UBEPBDPAXPAVbtSerializer@@@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::serializeSingleShape(class btSerializer *)const " (?serializeSingleShape@btCollisionShape@@UBEXPAVbtSerializer@@@Z)
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall btConvexShape::~btConvexShape(void)" (??1btConvexShape@@UAE@XZ) referenced in function "public: virtual __thiscall btConvexInternalShape::~btConvexInternalShape(void)" (??1btConvexInternalShape@@UAE@XZ)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexShape::project(class btTransform const &,class btVector3 const &,float &,float &,class btVector3 &,class btVector3 &)const " (?project@btConvexShape@@UBEXABVbtTransform@@ABVbtVector3@@AAM2AAV3@3@Z)
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "protected: __thiscall btConvexInternalShape::btConvexInternalShape(void)" (??0btConvexInternalShape@@IAE@XZ) referenced in function "public: __thiscall btSphereShape::btSphereShape(float)" (??0btSphereShape@@QAE@M@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual class btVector3 __thiscall btConvexInternalShape::localGetSupportingVertex(class btVector3 const &)const " (?localGetSupportingVertex@btConvexInternalShape@@UBE?AVbtVector3@@ABV2@@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexInternalShape::getAabbSlow(class btTransform const &,class btVector3 &,class btVector3 &)const " (?getAabbSlow@btConvexInternalShape@@UBEXABVbtTransform@@AAVbtVector3@@1@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexInternalShape::setLocalScaling(class btVector3 const &)" (?setLocalScaling@btConvexInternalShape@@UAEXABVbtVector3@@@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual class btVector3 __thiscall btSphereShape::localGetSupportingVertex(class btVector3 const &)const " (?localGetSupportingVertex@btSphereShape@@UBE?AVbtVector3@@ABV2@@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual class btVector3 __thiscall btSphereShape::localGetSupportingVertexWithoutMargin(class btVector3 const &)const " (?localGetSupportingVertexWithoutMargin@btSphereShape@@UBE?AVbtVector3@@ABV2@@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(class btVector3 const *,class btVector3 *,int)const " (?batchedUnitVectorGetSupportingVertexWithoutMargin@btSphereShape@@UBEXPBVbtVector3@@PAV2@H@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btSphereShape::calculateLocalInertia(float,class btVector3 &)const " (?calculateLocalInertia@btSphereShape@@UBEXMAAVbtVector3@@@Z)
4>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btSphereShape::getAabb(class btTransform const &,class btVector3 &,class btVector3 &)const " (?getAabb@btSphereShape@@UBEXABVbtTransform@@AAVbtVector3@@1@Z)
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: __thiscall btStaticPlaneShape::btStaticPlaneShape(class btVector3 const &,float)" (??0btStaticPlaneShape@@QAE@ABVbtVector3@@M@Z) referenced in function _main
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: __thiscall btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(struct btDefaultCollisionConstructionInfo const &)" (??0btDefaultCollisionConfiguration@@QAE@ABUbtDefaultCollisionConstructionInfo@@@Z) referenced in function _main
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: __thiscall btDbvtBroadphase::btDbvtBroadphase(class btOverlappingPairCache *)" (??0btDbvtBroadphase@@QAE@PAVbtOverlappingPairCache@@@Z) referenced in function _main
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: __thiscall btDiscreteDynamicsWorld::btDiscreteDynamicsWorld(class btDispatcher *,class btBroadphaseInterface *,class btConstraintSolver *,class btCollisionConfiguration *)" (??0btDiscreteDynamicsWorld@@QAE@PAVbtDispatcher@@PAVbtBroadphaseInterface@@PAVbtConstraintSolver@@PAVbtCollisionConfiguration@@@Z) referenced in function _main
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: __thiscall btRigidBody::btRigidBody(struct btRigidBody::btRigidBodyConstructionInfo const &)" (??0btRigidBody@@QAE@ABUbtRigidBodyConstructionInfo@0@@Z) referenced in function _main
4>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: __thiscall btSequentialImpulseConstraintSolver::btSequentialImpulseConstraintSolver(void)" (??0btSequentialImpulseConstraintSolver@@QAE@XZ) referenced in function _main
4>C:\Users\Nick\Desktop\tutorial\BulletTestApp\Debug\BulletTestApp.exe : fatal error LNK1120: 23 unresolved externals
4>Done building project "BulletTestApp.vcxproj" -- FAILED.
========== Build: 3 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Re: LNK2019 Error with Hello World

Posted: Wed Mar 15, 2017 1:23 pm
by S1L3nCe
You need to link your project with BulletCollision, BulletDynamics and LinearMath libraries.
Check Properties>Linker>Input if you have them in Additional dependencies.

Re: LNK2019 Error with Hello World

Posted: Wed Mar 15, 2017 1:45 pm
by Tearhead
Not seeing them. But when I try to add them it's telling me it cannot open file. I've tried Bullet3Collision_Debug.lib, Bullet3Collision.lib and BulletCollision.lib

Re: LNK2019 Error with Hello World

Posted: Wed Mar 15, 2017 1:56 pm
by S1L3nCe
I personally have in debug:
LinearMath_Debug.lib
BulletCollision_Debug.lib
BulletDynamics_Debug.lib
Edit: don't forget to set them with their path

Re: LNK2019 Error with Hello World

Posted: Wed Mar 15, 2017 2:08 pm
by Tearhead
OK, yeah, I have those in my debug folder, and added them to the additional dependencies, but still getting the error.

Do I have to have the linker point to the debug folder?

EDIT: Figured it out. Had to enter the entire path. Thanks!

Re: LNK2019 Error with Hello World

Posted: Wed Mar 15, 2017 2:14 pm
by S1L3nCe
You have no path set for them, so Visual is searching at the root of the project.
Add absolute path of the libraries