Hi all!
I gave a try for the Havok api, but there is a strange linking problem. If I try to include havok headers more then one of my headers, the compiler (using VC2008 EE) gives theese errors:
phx_object.obj : error LNK2005: "char const * const HK_PHYSICS_KEYCODE" (?HK_PHYSICS_KEYCODE@@3QBDB) already defined in havok_core.obj
phx_object.obj : error LNK2005: "char const * const HK_ANIMATION_KEYCODE" (?HK_ANIMATION_KEYCODE@@3QBDB) already defined in havok_core.obj
phx_object.obj : error LNK2005: "char const * const HK_BEHAVIOR_KEYCODE" (?HK_BEHAVIOR_KEYCODE@@3QBDB) already defined in havok_core.obj
phx_object.obj : error LNK2005: "char const * const HK_CLOTH_KEYCODE" (?HK_CLOTH_KEYCODE@@3QBDB) already defined in havok_core.obj
phx_object.obj : error LNK2005: "char const * const HK_DESTRUCTION_KEYCODE" (?HK_DESTRUCTION_KEYCODE@@3QBDB) already defined in havok_core.obj
phx_object.obj : error LNK2005: "char const * const HK_AI_KEYCODE" (?HK_AI_KEYCODE@@3QBDB) already defined in havok_core.obj
phx_object.obj : error LNK2005: "public: static class hkTypeInfo const * const * const hkBuiltinTypeRegistry::StaticLinkedTypeInfos" (?StaticLinkedTypeInfos@hkBuiltinTypeRegistry@@2QBQBVhkTypeInfo@@B) already defined in havok_core.obj
phx_object.obj : error LNK2005: "public: static class hkClass const * const * const hkBuiltinTypeRegistry::StaticLinkedClasses" (?StaticLinkedClasses@hkBuiltinTypeRegistry@@2QBQBVhkClass@@B) already defined in havok_core.obj
phx_object.obj : error LNK2005: "public: static struct hkVersionRegistry::Updater const * * hkVersionRegistry::StaticLinkedUpdaters" (?StaticLinkedUpdaters@hkVersionRegistry@@2PAPBUUpdater@1@A) already defined in havok_core.obj
phx_object.obj : error LNK2005: "public: static class hkStaticClassNameRegistry const * * hkVersionRegistry::StaticLinkedClassRegistries" (?StaticLinkedClassRegistries@hkVersionRegistry@@2PAPBVhkStaticClassNameRegistry@@A) already defined in havok_core.obj
First, I tried to include only to cpp files, but more than one causes a problem there too. Each of my headers has the #pragma once / #ifndef stuff (tried both), but no success.
I've tried a very simple console project to test it:
// header1.h
#pragma once // same with #ifndef's
#include "havoc_headers.h"
// cpp1
#include "header1.h"
// cpp2
#include "header1.h"
int main()
{
return 0;
}
// ...the linker yells
I can solve this with using only one .cpp to handle all Havok related code, but that would be quite messy.
What do you think?