Havok Unresolved External Symbols

I am doing a project for an MSC games course for which we are using Havok and it is my job to integrate it :p. Included all the files we need to use, undefined bits we don't need and written a class to set up everything which i called Physics.h and it can be seen below.

This compiles fine until I try to use it. I make a pointer to the class:

Physics *physics

and then initialise it :

physics = new Physics(true)

and it gives me a list of 27 unresolved external symbols here are the first few:

1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall hkpWorldCinfo::hkpWorldCinfo(void)" (??0hkpWorldCinfo@@QAE@XZ) referenced in function "public: __thiscall Physics::Physics(bool)" (??0Physics@@QAE@_N@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual class hkClass const * __thiscall hkReferencedObject::getClassType(void)const " (?getClassType@hkReferencedObject@@UBEPBVhkClass@@XZ)
1>main.obj : error LNK2001: unresolved external symbol "protected: static class hkThreadLocalData<class hkMemoryRouter *> hkMemoryRouter::s_memoryRouter" (?s_memoryRouter@hkMemoryRouter@@1V?$hkThreadLocalData@PAVhkMemoryRouter@@@@A)
1>main.obj : error LNK2001: unresolved external symbol "protected: static class hkMemoryTracker * hkMemoryTracker::s_singleton" (?s_singleton@hkMemoryTracker@@1PAV1@A)
1>main.obj : error LNK2019: unresolved external symbol "public: void __cdecl hkMonitorStream::resize(int)" (?resize@hkMonitorStream@@QAAXH@Z) referenced in function "private: void __thiscall Physics::initMemory(void)" (?initMemory@Physics@@AAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall hkCpuJobThreadPoolCinfo::hkCpuJobThreadPoolCinfo(void)" (??0hkCpuJobThreadPoolCinfo@@QAE@XZ) referenced in function "private: void __thiscall Physics::initMemory(void)" (?initMemory@Physics@@AAEXXZ)

Has anyone got any idea what is going on here I am not getting anywhere....

Code:

#include <Common/Base/hkBase.h>
#include <Common/Base/System/hkBaseSystem.h>
#include <Common/Base/System/Error/hkDefaultError.h>
#include <Common/Base/Memory/System/hkMemorySystem.h>
#include <Common/Base/Memory/System/Util/hkMemoryInitUtil.h>
#include <Common/Base/Memory/Allocator/Malloc/hkMallocAllocator.h>
#include <Common/Base/Thread/Job/ThreadPool/Cpu/hkCpuJobThreadPool.h>

#include <Physics/Dynamics/World/hkpWorld.h>
#include <Physics/Collide/Dispatch/hkpAgentRegisterUtil.h>

#include <Physics/Collide/Shape/Convex/Box/hkpBoxShape.h>
#include <Physics/Dynamics/Entity/hkpRigidBody.h>
#include <Physics/Utilities/Dynamics/Inertia/hkpInertiaTensorComputer.h>

#include <Common/Visualize/hkVisualDebugger.h>
#include <Physics/Utilities/VisualDebugger/hkpPhysicsContext.h>

#include <Common/Base/keycode.cxx>

//excludes bits of Havok that we are not using, reducing Havok's footprint in memory
#undef HK_FEATURE_PRODUCT_AI
#undef HK_FEATURE_PRODUCT_ANIMATION
#undef HK_FEATURE_PRODUCT_CLOTH
#undef HK_FEATURE_PRODUCT_DESTRUCTION
#undef HK_FEATURE_PRODUCT_BEHAVIOR
#define HK_FEATURE_REFLECTION_PHYSICS
#define HK_CLASSES_FILE <Common/Serialize/Classlist/hkClasses.h>
#define HK_EXCLUDE_FEATURE_MemoryTracker
#define HK_EXCLUDE_FEATURE_SerializeDeprecatedPre700
#define HK_EXCLUDE_FEATURE_RegisterVersionPatches
#define HK_EXCLUDE_LIBRARY_hkGeometryUtilitiesb

#ifndef PHYSICS
#define PHYSICS

class Physics {

public:

Physics();

Physics(bool debug_enabled) {

debug_enabled_ = debug_enabled;
havokInit();
}

~Physics() {

deinitHavok();

}

//accessors
hkpWorld* getWorld() { return physics_world_; }

//methods
void havokInit() {

//show console
AllocConsole();
freopen("conin$","r",stdin);
freopen("conout$","w",stdout);
freopen("conout$","w",stderr);

initMemory();
initPhysicsWorld();

if (debug_enabled_) initDebugger();

}

void deinitHavok() {

physics_world_->markForWrite();
physics_world_->removeReference();

if (debug_enabled_) deinitDebugger();

hkBaseSystem::quit();
hkMemoryInitUtil::quit();

}

void stepSimulation(float deltaTime) {

stepPhysicsSimulation(deltaTime);

if (debug_enabled_) stepVDBSimulation();

hkMonitorStream::getInstance().reset();

}



private:

bool debug_enabled_;
hkpPhysicsContext* context_;
hkVisualDebugger* visual_debugger_;

hkpWorld* physics_world_;
hkpWorldCinfo physics_world_info_;

void initMemory() {

hkMemoryRouter* memoryRouter = hkMemoryInitUtil::initDefault( hkMallocAllocator::m_defaultMallocAllocator, hkMemorySystem::FrameInfo( 500* 1024 ) );
//hkBaseSystem::init(memoryRouter, errorReport);//this also breaks it

int totalNumThreadsUsed;

hkHardwareInfo hwInfo;
hkGetHardwareInfo(hwInfo);
totalNumThreadsUsed = hwInfo.m_numThreads;

hkCpuJobThreadPoolCinfo threadPoolCinfo;
threadPoolCinfo.m_numThreads = totalNumThreadsUsed - 1;

threadPoolCinfo.m_timerBufferPerThreadAllocation = 200000;

hkJobQueueCinfo info;
info.m_jobQueueHwSetup.m_numCpuThreads = totalNumThreadsUsed;

hkMonitorStream::getInstance().resize(200000);

}


void initPhysicsWorld() {

physics_world_info_.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_MULTITHREADED;

physics_world_info_.m_broadPhaseBorderBehaviour = hkpWorldCinfo::BROADPHASE_BORDER_REMOVE_ENTITY;

physics_world_ = new hkpWorld(physics_world_info_);

physics_world_->m_wantDeactivation = false;

physics_world_->markForWrite();

hkpAgentRegisterUtil::registerAllAgents( physics_world_->getCollisionDispatcher() );

}

void initDebugger() {

hkArray<hkProcessContext*> contexts;

{

context_ = new hkpPhysicsContext();
hkpPhysicsContext::registerAllPhysicsProcesses();
context_->addWorld(physics_world_);
contexts.pushBack(context_);

physics_world_->unmarkForWrite();

}

visual_debugger_ = new hkVisualDebugger(contexts);
visual_debugger_->serve();

}

void deinitDebugger() {

visual_debugger_->removeReference();
context_->removeReference();

}

void stepPhysicsSimulation(float delta_time_) {

physics_world_->stepDeltaTime(delta_time_);
}

void stepVDBSimulation() {

visual_debugger_->step();

}

};

#endif

<nolyc> Undefined reference is a linker error.
It's not a compile error. #includes don't help.
You did not define the thing in the error message, you forgot to link the file that defines it, you forgot to link to the library that defines it, or, if it's a static library, you have the wrong order on the linker command line.
Check which one. (Note that some linkers call it an unresolved external)
Topic archived. No new replies allowed.