Linker errors with 'Creating a Project from Scratch'

InsertWittyName
Posts: 6
Joined: Sat Nov 20, 2010 5:14 pm

Linker errors with 'Creating a Project from Scratch'

Post by InsertWittyName »

Hi guys,

I've been trying to get Bullet working using the following tutorial: http://www.bulletphysics.org/mediawiki- ... om_scratch

- I downloaded bullet-2.77.zip, and extracted it to c:\develop
- Using CMake 2.83, I built Bullet in c:/develop/tutorial/BulletBuild, using Visual Studio 10 as the compiler
- I create a new project in Visual Studio 2010, a Win32 Console Application, called BulletTestApp
- I add the BulletCollision.vcxproj, BulletDynamics.vcxproj and LinearMath.vcxproj from C:/develop/tutorial/BulletBuild/src/... to the project
- I set the project dependencies for the BulletTestApp, ticking BulletCollision, BulletDynamics and LinearMath
- I set the Additional Include Directories for BulletTestApp to c:\develop\bullet-2.77\src (for all configurations)

The program code is:

Code: Select all

#include "stdafx.h"
#include "btBulletDynamicsCommon.h"

int _tmain(int argc, _TCHAR* argv[])
{
	btBoxShape* box = new btBoxShape(btVector3(1,1,1));
	return 0;
}
Which produces:

1>------ Build started: Project: BulletTestApp, Configuration: Debug Win32 ------
1>Build started 20/11/2010 17:47:47.
1>InitializeBuildStatus:
1> Creating "Debug\BulletTestApp.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> All outputs are up-to-date.
1> BulletTestApp.cpp
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>BulletTestApp.obj : error LNK2019: unresolved external symbol "void * __cdecl btAlignedAllocInternal(unsigned int,int)" (?btAlignedAllocInternal@@YAPAXIH@Z) referenced in function "public: static void * __cdecl btConvexShape::operator new(unsigned int)" (??2btConvexShape@@SAPAXI@Z)
1>BulletTestApp.obj : error LNK2019: unresolved external symbol "void __cdecl btAlignedFreeInternal(void *)" (?btAlignedFreeInternal@@YAXPAX@Z) referenced in function "public: static void __cdecl btConvexShape::operator delete(void *)" (??3btConvexShape@@SAXPAX@Z)
1>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: __thiscall btPolyhedralConvexShape::btPolyhedralConvexShape(void)" (??0btPolyhedralConvexShape@@QAE@XZ) referenced in function "public: __thiscall btBoxShape::btBoxShape(class btVector3 const &)" (??0btBoxShape@@QAE@ABVbtVector3@@@Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btBoxShape::getAabb(class btTransform const &,class btVector3 &,class btVector3 &)const " (?getAabb@btBoxShape@@UBEXABVbtTransform@@AAVbtVector3@@1@Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::getBoundingSphere(class btVector3 &,float &)const " (?getBoundingSphere@btCollisionShape@@UBEXAAVbtVector3@@AAM@Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getAngularMotionDisc(void)const " (?getAngularMotionDisc@btCollisionShape@@UBEMXZ)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getContactBreakingThreshold(float)const " (?getContactBreakingThreshold@btCollisionShape@@UBEMM@Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btBoxShape::calculateLocalInertia(float,class btVector3 &)const " (?calculateLocalInertia@btBoxShape@@UBEXMAAVbtVector3@@@Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::serializeSingleShape(class btSerializer *)const " (?serializeSingleShape@btCollisionShape@@UBEXPAVbtSerializer@@@Z)
1>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)
1>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)
1>BulletTestApp.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall btConvexInternalShape::setLocalScaling(class btVector3 const &)" (?setLocalScaling@btConvexInternalShape@@UAEXABVbtVector3@@@Z) referenced in function "public: virtual void __thiscall btBoxShape::setLocalScaling(class btVector3 const &)" (?setLocalScaling@btBoxShape@@UAEXABVbtVector3@@@Z)
1>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)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual class btVector3 __thiscall btConvexInternalShape::localGetSupportingVertex(class btVector3 const &)const " (?localGetSupportingVertex@btConvexInternalShape@@UBE?AVbtVector3@@ABV2@@Z)
1>C:\develop\tutorial\BulletTestApp\Debug\BulletTestApp.exe : fatal error LNK1120: 14 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.96
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

- As suggested in the tutorial, I then set Link Library Dependencies to 'Yes', for all configurations, for BulletCollision, BulletDynamics and LinearMath, but it produces the same 14 unresolved externals.

I've searched for threads regarding unresolved symbols and bullet, but none of them had answers which solved the problem. Can anyone suggest how I might go about fixing this?

Any help would be appreciated :)
InsertWittyName
Posts: 6
Joined: Sat Nov 20, 2010 5:14 pm

Re: Linker errors with 'Creating a Project from Scratch'

Post by InsertWittyName »

Fixed my own problem :D

In BulletTestApp's properties, I added new references to BulletCollision, BulletDynamics, and LinearMath.
mgangav
Posts: 2
Joined: Wed Feb 23, 2011 11:22 am

Re: Linker errors with 'Creating a Project from Scratch'

Post by mgangav »

InsertWittyName wrote:Fixed my own problem :D

In BulletTestApp's properties, I added new references to BulletCollision, BulletDynamics, and LinearMath.
Hello,

I think that I am having the same problem as you did. Could you please tell me how you added references to the libraries. Right now, I BulletTestApp Properties -> VC++ Directories -> Library Directories has the path to the library that has all the compiled library files in it. Is there anything else you did?
mgangav
Posts: 2
Joined: Wed Feb 23, 2011 11:22 am

Re: Linker errors with 'Creating a Project from Scratch'

Post by mgangav »

Oh never mind, I solved my issue. After performing all the steps mentioned previously in this thread, I did the following:

1) I use MSVS 2010 x64, so I had cMake build the libraries using the MSVS 2010 64 bit generator. But, while making the BulletTestApp project, I chose the target platform as Win32. I changed the target platform to x64 for BulletTestApp.

2) I went to BulletTestApp (Right Click on the project name) -> Add -> Existing Item. Then I added BulletCollision.lib, BulletDynamicslib and LinearMath.lib to the project.