Weird Linker Errors

Weird Linker Errors

First off, i'd like to congratulate the Havok team for making my Dream come true. Second, for some reason, i get these linker errors:

1>hkSerialize.lib(hkBuiltinTypeRegistry.obj) : error LNK2001: unresolved external symbol "public: static class hkClass const * const * const hkBuiltinTypeRegistry::StaticLinkedClasses" (?StaticLinkedClasses@hkBuiltinTypeRegistry@@2QBQBVhkClass@@B)

1>hkSerialize.lib(hkBuiltinTypeRegistry.obj) : error LNK2001: unresolved external symbol "public: static class hkTypeInfo const * const * const hkBuiltinTypeRegistry::StaticLinkedTypeInfos" (?StaticLinkedTypeInfos@hkBuiltinTypeRegistry@@2QBQBVhkTypeInfo@@B)

1>hkSerialize.lib(hkVersionRegistry.obj) : error LNK2001: unresolved external symbol "public: static struct hkVersionRegistry::Updater const * * hkVersionRegistry::StaticLinkedUpdaters" (?StaticLinkedUpdaters@hkVersionRegistry@@2PAPBUUpdater@1@A)

1>hkSerialize.lib(hkVersionRegistry.obj) : error LNK2001: unresolved external symbol "public: static class hkStaticClassNameRegistry const * * hkVersionRegistry::StaticLinkedClassRegistries" (?StaticLinkedClassRegistries@hkVersionRegistry@@2PAPBVhkStaticClassNameRegistry@@A)

1>C:Documents and SettingsDirectXMy DocumentsVisual Studio 2005ProjectsHavok_TrialDebugHavok_Trial.exe : fatal error LNK1120: 4 unresolved externals

1>Build log was saved at "file://c:Documents and SettingsDirectXMy DocumentsVisual Studio 2005ProjectsHavok_TrialHavok_TrialDebugBuildLog.htm"

1>Havok_Trial - 5 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

and here is my .cpp code.

(I don't know the code tags, so i don't know how to put it in code form.)

.CPP:

#include "Havok.h"

hkPoolMemory* MemoryManager;

hkThreadMemory* Threads;

hkpWorld* PhysicalWorld;

hkpMultithreadingUtil* multithreadingutil;

static void HK_CALL ErrorMessagerHandler(const char* msg,void*)

{

char mess[100];

sprintf(mess,"An error has occured with Havok %s",msg);

MessageBox(NULL,(LPCWSTR)msg,(LPCWSTR)msg,MB_OK);

}

int InitializeHavok()

{

MemoryManager = new hkPoolMemory();

Threads = new hkThreadMemory(MemoryManager,MAX_THREADS);

hkBaseSystem::init(MemoryManager,

Thread
s,

ErrorMessagerHandler);

char* stackBuffer;

{

int StackSize = 0x1000000;

stackBuffer = hkAllocate<char>( StackSize, HK_MEMORY_CLASS_BASE);

hkThreadMemory::getInstance().setStackArea(stackBuffer, StackSize);

}

{

hkpWorld* PhysicalWorld;

{

hkpWorldCinfo worldInfo;

worldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_MULTITHREADED;

PhysicalWorld = new hkpWorld(worldInfo);

}

{

hkMemory::getInstance().preAllocateRuntimeBlock(512000,HK_MEMORY_CLASS_BASE);

hkMemory::getInstance().preAllocateRuntimeBlock(256000,HK_MEMORY_CLASS_BASE);

hkMemory::getInstance().preAllocateRuntimeBlock(128000,HK_MEMORY_CLASS_BASE);

hkMemory::getInstance().preAllocateRuntimeBlock(64000, HK_MEMORY_CLASS_BASE);

hkMemory::getInstance().preAllocateRuntimeBlock(32000, HK_MEMORY_CLASS_BASE);

hkMemory::getInstance().preAllocateRuntimeBlock(16000, HK_MEMORY_CLASS_BASE);

hkMemory::getInstance().preAllocateRuntimeBlock(16000, HK_MEMORY_CLASS_BASE);

}

PhysicalWorld->markForWrite();

{

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

}

hkpMultithreadingUtilCinfo info;

info.m_world = PhysicalWorld;

info.m_numThreads = MAX_THREADS;

info.m_enableTimers = true;

hkpMultithreadingUtil* multithreadingutil = new hkpMultithreadingUtil(info);

hkpPhysicsContext* context = new hkpPhysicsContext();

hkpPhysicsContext::registerAllPhysicsProcesses();

context->addWorld(PhysicalWorld);

hkVisualDebugger* vdb = SetupVisualDebugger(context);

context->m_monitorStreamBegins.setSize(MAX_THREADS);

context->m_monitorStreamEnds.setSize(MAX_THREADS);

PhysicalWorld->unmarkForWrite();

}

return 1;

}

void UpdateHavok()

{

hkStopwatch StopWatch;

StopWatch.start();

hkReal lasttime = StopWatch.getElapsedSeconds();

hkReal timeStep = 1.0f/ 60.0f;

int numSteps = int(60.0f / timeStep);

for(int i = 0; i < numSteps; i++)

{

PhysicalWorld->resetThreadTokens();

multithreadingutil->startStepWorld
( timeStep);

}

hkBaseSystem::quit();

}

hkVisualDebugger* SetupVisualDebugger(hkpPhysicsContext *world)

{

hkArray contexts;

contexts.pushBack(world);

hkVisualDebugger* vdb = new hkVisualDebugger(contexts);

vdb->serve();

return vdb;

}

void StepVisualDebugger(hkVisualDebugger* vdb, hkpMultithreadingUtil* multithreadingutil, hkpPhysicsContext *Context)

{

Context->m_monitorStreamBegins.setSize(MAX_THREADS);

Context->m_monitorStreamEnds.setSize(MAX_THREADS);

for(int j = 0; j < multithreadingutil->getNumThreads(); ++j)

{

Context->m_monitorStreamBegins[j] = multithreadingutil->m_state.m_workerThreads[j].m_monitorStreamBegin;

Context->m_monitorStreamEnds[j] = multithreadingutil->m_state.m_workerThreads[j].m_monitorStreamEnd;

}

vdb->serve();

}

the errors r in this file because if i comment it out it compiles good. hopefully someone could help me. also, does it matter if i included just one file? cause i included the file that has all the files inside of it.

publicaciones de 13 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hello, I ran into the same problem when I tried to set up the visual debugger.

The visual debugger uses the havok serialization to communicate over the network. The documentation tells you how to set up the visual debugger here:
"Havok Physics | 8. Using the visual debugger | 3. Visual Debugger Game Side"

But it doesn't tell you that you need to set up the serialization for it, which is in the:
"Common Havok Components | 3. Serialization | 6. Type Registration"

Here's what I added to use all of the default types. It should be customized later I guess.

// TODO: Generate a custom lists to trim memory requirements
#define HK_CLASSES_FILE
#include

#define HK_COMPAT_FILE
#include

`John

Thanks, it worked. now it seems i have another problem. for some reason iget linker errors such as this:

1>CModel.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification

1>Physics.obj : error LNK2005: "char const * const HK_KEYCODE" (?HK_KEYCODE@@3QBDB) already defined in game.obj

1>Physics.obj : error LNK2005: "unsigned int const HK_KEYVALUE" (?HK_KEYVALUE@@3IB) already defined in game.obj

1>Physics.obj : error LNK2005: "public: static class hkTypeInfo const * const * const hkBuiltinTypeRegistry::StaticLinkedTypeInfos" (?StaticLinkedTypeInfos@hkBuiltinTypeRegistry@@2QBQBVhkTypeInfo@@B) already defined in game.obj

1>Physics.obj : error LNK2005: "public: static class hkClass const * const * const hkBuiltinTypeRegistry::StaticLinkedClasses" (?StaticLinkedClasses@hkBuiltinTypeRegistry@@2QBQBVhkClass@@B) already defined in game.obj

1>Physics.obj : error LNK2005: "public: static struct hkVersionRegistry::Updater const * * hkVersionRegistry::StaticLinkedUpdaters" (?StaticLinkedUpdaters@hkVersionRegistry@@2PAPBUUpdater@1@A) already defined in game.obj

1>Physics.obj : error LNK2005: "public: static class hkStaticClassNameRegistry const * * hkVersionRegistry::StaticLinkedClassRegistries" (?StaticLinkedClassRegistries@hkVersionRegistry@@2PAPBVhkStaticClassNameRegistry@@A) already defined in game.obj

1>winmain.obj : error LNK2005: "char const * const HK_KEYCODE" (?HK_KEYCODE@@3QBDB) already defined in game.obj

1>winmain.obj : error LNK2005: "unsigned int const HK_KEYVALUE" (?HK_KEYVALUE@@3IB) already defined in game.obj

1>winmain.obj : error LNK2005: "public: static class hkTypeInfo const * const * const hkBuiltinTypeRegistry::StaticLinkedTypeInfos" (?StaticLinkedTypeInfos@hkBuiltinTypeRegistry@@2QBQBVhkTypeInfo@@B) already defined in game.obj

1>winmain.obj : error LNK2005: "public: static class hkClass const * const * const hkBuiltinTypeRegistry::StaticLinkedClasses" (?StaticLinkedClasses@hkBuiltinTypeRegistry@@2QBQBVhkClass@@B) already defined in game.obj

1>winmain.obj : error LNK2005: "public: static struct hkVersionRegistry::Updater const * * hkVersionRegistry::StaticLinkedUpdaters" (?StaticLinkedUpdaters@hkVersionRegistry@@2PAPBUUpdater@1@A) already defined in game.obj

1>winmain.obj : error LNK2005: "public: static class hkStaticClassNameRegistry const * * hkVersionRegistry::StaticLinkedClassRegistries" (?StaticLinkedClassRegistries@hkVersionRegistry@@2PAPBVhkStaticClassNameRegistry@@A) already defined in game.obj

1>.Debug/Framework.exe : fatal error LNK1169: one or more multiply defined symbols found

1>Build log was saved at "file://c:Documents and SettingsDirectXDesktopsourceschapter14FrameworkBuildLog.htm"

1>Framework - 13 error(s), 1 warning(s)

if i remove the "Physics" file, it works with out any problems. i've searched through all my source files and can't seem to find another instance of Physics.h. so i don't know what it could be.

you should probably just include the relevant headers instead of the global header. A good place to start is the stand-alone demo.

Make sure you can run that and build up from there.

Well, i think it was microsoft 2008 because i made a new project in 2005 and now i get these errors, which to me make so sense, do they to you?

1>h:havokhavok_physics_animation_550_pc_xs_win32_vs2005_keycode_perpetual_20080530hk550sourcecommonase hreadcriticalsectionwin32hkwin32criticalsection.inl(27) : error C3861: 'InitializeCriticalSectionAndSpinCount': identifier not found

1>h:havokhavok_physics_animation_550_pc_xs_win32_vs2005_keycode_perpetual_20080530hk550sourcecommonase hreadcriticalsectionwin32hkwin32criticalsection.inl(88) : error C3861: 'TryEnterCriticalSection': identifier not found

1>c:documents and settingsdirectxmy documentsvisual studio 2005projectscor_enginecor_enginewindmain.cpp(114) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data

1>Build log was saved at file://c:Documents and SettingsDirectXMy DocumentsVisual Studio 2005ProjectsCor_EngineCor_EngineDebugBuildLog.htm

I'm at my witt's end here!!!

To compile an application that uses InitializeCriticalSectionAndSpinCount, define _WIN32_WINNT as 0x0403 or later. For more information, see Using the Windows Headers.

would i put it in the main file where windows is? cause i still get those errors if i put it in Physics.h it still gives me those errors. I seem to have a hard time setting Havok up..i mean PjysX didn't giuve me that much trouble...but then again i don't want to use PhysX HAVOK IS GOD/GOOD

Hi there,

That's a pity that you are hitting a few teething issues. I'm sure we can work through them in no time, and you can have your game up and running with Havok Complete!

The best place to define _WIN32_WINNT and WINVER is by right clicking on your VCPROJ, clicking properties, C++, Preprocessor, and assing it to the preprocessor defines. Add "WINVER=0x500, _WIN32_WINNT=0x500".

Thanks,

Marc

Hey marc, i'd really appreciate it if you could show us a demo or sample of type registration alongside the hkAnimationPhysicsPublicInclude.h header include

I've been working on it all day and cant seem to get past either the errors that the poster encountered in his first post or great long lists of unresolved external symbol errors.

My code is copy & pasted from the help file supplied with the sdk and does the following:

#ifndef __GAMEPHYSICS_H
#define __GAMEPHYSICS_H

#include

#define HK_CLASSES_FILE

#include hkBuiltinTypeRegistry.cxx>

class GamePhysics
{
// physics code
};

#endif

Nick

Hi Nick,

I won't have a chance until the morning.

Marc

nkostelnik:Hey marc, i'd really appreciate it if you could show us a demo or sample of type registration alongside the hkAnimationPhysicsPublicInclude.h header include

I've been working on it all day and cant seem to get past either the errors that the poster encountered in his first post or great long lists of unresolved external symbol errors.

Hi

It seems you have not included

#define HK_COMPAT_FILE

#include

into your code. But you may have noticed that already yourself.

I also would like to say that "hkCompat_All.cxx" is needed only if you have old assets (pre-5.5, some of the .hkx/.xml files included with the demos are older and need versioning steps) and you want them to use in your game, but if you want to save some bytes on the size of your app and you know that you will not use the old assets then you should include the following lines into your code:

// strip down unused static data for old classes and compatibility code

#include

So, the hkVersionRegistry::StaticLinkedUpdaters and hkVersionRegistry::StaticLinkedClassRegistries get defined.

Yuriy

Oops, sorry, for some parts of my message was omitted:

(*) use old version assets


#define HK_COMPAT_FILE

#include

(**) no old version assets


#include

Yuriy

This is terrible - everything within angle brackes get stripped, again:

(*) use old version assets

#define HK_COMPAT_FILE
#include

(**) no old version assets

#include

:)

Yuriy

Inicie sesión para dejar un comentario.