gpt4 book ai didi

c++ - 仅在使用 Havok SDK 时出现的链接器错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:22:24 24 4
gpt4 key购买 nike

我正在与 Havok Physics 合作,当我进行一些学习和练习时,我有一个专门针对 Havok 的项目。现在我想将它包含到我的游戏中,但我遇到了这些错误。

Somefile.obj : error LNK2005: "public: static class hkTypeInfo const * const * const hkBuiltinTypeRegistry::StaticLinkedTypeInfos" (?StaticLinkedTypeInfos@hkBuiltinTypeRegistry@@2QBQBVhkTypeInfo@@B) already defined in
Somefile.obj : error LNK2005: "public: static class hkClass const * const * const hkBuiltinTypeRegistry::StaticLinkedClasses" (?StaticLinkedClasses@hkBuiltinTypeRegistry@@2QBQBVhkClass@@B) already defined in
Somefile.obj : error LNK2005: "char const * const HK_PHYSICS_2012_KEYCODE" (?HK_PHYSICS_2012_KEYCODE@@3QBDB) already defined in
Somefile.obj : error LNK2005: "char const * const HK_PHYSICS_KEYCODE" (?HK_PHYSICS_KEYCODE@@3QBDB) already defined in
Somefile.obj : error LNK2005: "char const * const HK_ANIMATION_KEYCODE" (?HK_ANIMATION_KEYCODE@@3QBDB) already defined in
Somefile.obj : error LNK2005: "char const * const HK_BEHAVIOR_KEYCODE" (?HK_BEHAVIOR_KEYCODE@@3QBDB) already defined in
Somefile.obj : error LNK2005: "char const * const HK_CLOTH_KEYCODE" (?HK_CLOTH_KEYCODE@@3QBDB) already defined in
Somefile.obj : error LNK2005: "char const * const HK_DESTRUCTION_2012_KEYCODE" (?HK_DESTRUCTION_2012_KEYCODE@@3QBDB) already defined in
Somefile.obj : error LNK2005: "char const * const HK_DESTRUCTION_KEYCODE" (?HK_DESTRUCTION_KEYCODE@@3QBDB) already defined in
Somefile.obj : error LNK2005: "char const * const HK_AI_KEYCODE" (?HK_AI_KEYCODE@@3QBDB) already defined in
Somefile.obj : error LNK2005: "public: static struct hkVersionRegistry::Updater const * * hkVersionRegistry::StaticLinkedUpdaters" (?StaticLinkedUpdaters@hkVersionRegistry@@2PAPBUUpdater@1@A) already defined in
Somefile.obj : error LNK2005: "public: static class hkStaticClassNameRegistry const * * hkVersionRegistry::StaticLinkedClassRegistries" (?StaticLinkedClassRegistries@hkVersionRegistry@@2PAPBVhkStaticClassNameRegistry@@A) already defined in
Somefile.obj : error LNK2005: "void __cdecl hkProductFeatures::initialize(void)" (?initialize@hkProductFeatures@@YAXXZ) already defined in

每个文件都会出现这些错误,例如 Somefile.obj Somefile2.obj Somefile3.obj 等

我想我得到这个错误是因为我将文件相互包含的方式,因为当我将它包含到一个 cpp 文件中时,不同于将它包含到我的头文件中,它被包含到我的所有其他头文件中然后它工作。此错误仅发生在 Havok SDK 中。如果我以这种方式包含其他包含,如 DirectX SDK 和 FBX SDK,它们工作正常。

为了帮助你,这就是我的文件

我有一个 Include.h 文件,其中包含我所有的类声明,包括诸如 和 之类的内容,并包括我项目中的每个其他头文件。

这些是我包含在我的 Include.h 文件中的 Havoc header 。

#include <Common/Base/keycode.cxx>
#include <Common/Base/Config/hkProductFeatures.cxx>
#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 <Physics2012/Dynamics/World/hkpWorld.h>
#include <Physics2012/Collide/Dispatch/hkpAgentRegisterUtil.h>
#include <Physics2012\Collide\Shape\Convex\Box\hkpBoxShape.h>
#include <Physics2012\Dynamics\Entity\hkpRigidBody.h>
#include <Physics2012\Utilities\Dynamics\Inertia\hkpInertiaTensorComputer.h>
#include <Physics2012\Dynamics\World\hkpSimulationIsland.h>

然后我的所有其他头文件都包含 Include.h,这些文件包含我在其中声明的类。

希望这能为您提供足够的信息来帮助我解决这个问题,谢谢。

最佳答案

关于c++ - 仅在使用 Havok SDK 时出现的链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24066691/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com