Jump to content
  • Advertisement
Sign in to follow this  
hunpro

linking with havok

This topic is 3262 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
I haven't looked in our Havok wrapper in a while, but AFAIK there's no header file named "havok_headers.h" so that must be yours, in which case you should tell us what it contains as it could be the problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!