そのため、私のチームは、デバッグ モード (VS2013) でゲーム プロジェクトを再度正常にテストできるように、独自の shared_ptr 実装を実装しようとしています。ただし、次のエラーリストが発生しています
10>GameLogic.lib(GameLevel.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class LevelRuleset>::operator bool(void)const " (??B?$Handle@VLevelRuleset@@@@QBE_NXZ) referenced in function "public: void __thiscall GameLevel::GameLevelUpdate(float)" (?GameLevelUpdate@GameLevel@@QAEXM@Z)
10>Graphics.lib(AntTweakSys.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class LevelRuleset>::operator bool(void)const " (??B?$Handle@VLevelRuleset@@@@QBE_NXZ)
10>GameLogic.lib(GameLogicBehaviors.obj) : error LNK2019: unresolved external symbol "class Handle<class Component> __cdecl static_handle_cast<class Component,class ScaleBehavior>(class Handle<class ScaleBehavior> const &)" (??$static_handle_cast@VComponent@@VScaleBehavior@@@@YA?AV?$Handle@VComponent@@@@ABV?$Handle@VScaleBehavior@@@@@Z) referenced in function "public: void __thiscall GameLogic::AddGrowShrinkPlayer(unsigned long)" (?AddGrowShrinkPlayer@GameLogic@@QAEXK@Z)
10>Graphics.lib(Graphics.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Camera>::operator bool(void)const " (??B?$Handle@VCamera@@@@QBE_NXZ) referenced in function "private: void __thiscall GraphicsSystem::LoadGeneratedObjects(void)" (?LoadGeneratedObjects@GraphicsSystem@@AAEXXZ)
10>Graphics.lib(AntTweakSys.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class Camera>::operator bool(void)const " (??B?$Handle@VCamera@@@@QBE_NXZ)
10>Graphics.lib(DX11.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class Camera>::operator bool(void)const " (??B?$Handle@VCamera@@@@QBE_NXZ)
10>Graphics.lib(Graphics.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Debug>::operator bool(void)const " (??B?$Handle@VDebug@@@@QBE_NXZ) referenced in function "private: void __thiscall GraphicsSystem::LoadGeneratedObjects(void)" (?LoadGeneratedObjects@GraphicsSystem@@AAEXXZ)
10>Graphics.lib(AntTweakSys.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class Debug>::operator bool(void)const " (??B?$Handle@VDebug@@@@QBE_NXZ)
10>Graphics.lib(GFXMessageHandler.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class Debug>::operator bool(void)const " (??B?$Handle@VDebug@@@@QBE_NXZ)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Group>::operator bool(void)const " (??B?$Handle@VGroup@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class RigidBody>::operator bool(void)const " (??B?$Handle@VRigidBody@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(DX11.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class RigidBody>::operator bool(void)const " (??B?$Handle@VRigidBody@@@@QBE_NXZ)
10>Physics.lib(Physics.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class RigidBody>::operator bool(void)const " (??B?$Handle@VRigidBody@@@@QBE_NXZ)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Collider>::operator bool(void)const " (??B?$Handle@VCollider@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(DX11.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class Collider>::operator bool(void)const " (??B?$Handle@VCollider@@@@QBE_NXZ)
10>Physics.lib(Physics.obj) : error LNK2001: unresolved external symbol "public: __thiscall Handle<class Collider>::operator bool(void)const " (??B?$Handle@VCollider@@@@QBE_NXZ)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Controller>::operator bool(void)const " (??B?$Handle@VController@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Spawner>::operator bool(void)const " (??B?$Handle@VSpawner@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class PlayerStats>::operator bool(void)const " (??B?$Handle@VPlayerStats@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Gun>::operator bool(void)const " (??B?$Handle@VGun@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Owner>::operator bool(void)const " (??B?$Handle@VOwner@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class StatModifier>::operator bool(void)const " (??B?$Handle@VStatModifier@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Graphics.lib(AntTweakSys.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class LifeTime>::operator bool(void)const " (??B?$Handle@VLifeTime@@@@QBE_NXZ) referenced in function "private: static void __stdcall AntTweakSystem::AddObjectBar(void *)" (?AddObjectBar@AntTweakSystem@@CGXPAX@Z)
10>Input.lib(Input.obj) : error LNK2019: unresolved external symbol _SDL_GetError referenced in function "public: virtual void __thiscall InputSystem::Initialize(void)" (?Initialize@InputSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2001: unresolved external symbol _SDL_GetError
10>Input.lib(Input.obj) : error LNK2019: unresolved external symbol _SDL_PollEvent referenced in function "private: void __thiscall InputSystem::HandleEvents(void)" (?HandleEvents@InputSystem@@AAEXXZ)
10>Input.lib(Input.obj) : error LNK2019: unresolved external symbol _SDL_EventState referenced in function "private: void __thiscall InputSystem::HandleEvents(void)" (?HandleEvents@InputSystem@@AAEXXZ)
10>Input.lib(Input.obj) : error LNK2019: unresolved external symbol _SDL_Init referenced in function "public: virtual void __thiscall InputSystem::Initialize(void)" (?Initialize@InputSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2001: unresolved external symbol _SDL_Init
10>Input.lib(Input.obj) : error LNK2019: unresolved external symbol _SDL_QuitSubSystem referenced in function "public: virtual int __thiscall InputSystem::Release(void)" (?Release@InputSystem@@UAEHXZ)
10>Windows.lib(Windows.obj) : error LNK2001: unresolved external symbol _SDL_QuitSubSystem
10>Input.lib(Input.obj) : error LNK2019: unresolved external symbol "public: __thiscall Handle<class Component>::operator bool(void)const " (??B?$Handle@VComponent@@@@QBE_NXZ) referenced in function "private: void __thiscall InputSystem::HandleMessage(void)" (?HandleMessage@InputSystem@@AAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_RWFromFile referenced in function "public: virtual void __thiscall WindowSystem::Initialize(void)" (?Initialize@WindowSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_MapRGB referenced in function "public: virtual void __thiscall WindowSystem::Initialize(void)" (?Initialize@WindowSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_FreeSurface referenced in function "public: virtual void __thiscall WindowSystem::Initialize(void)" (?Initialize@WindowSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_LoadBMP_RW referenced in function "public: virtual void __thiscall WindowSystem::Initialize(void)" (?Initialize@WindowSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_FillRect referenced in function "public: virtual void __thiscall WindowSystem::Initialize(void)" (?Initialize@WindowSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_CreateWindow referenced in function "public: virtual void __thiscall WindowSystem::Initialize(void)" (?Initialize@WindowSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_SetWindowIcon referenced in function "public: virtual void __thiscall WindowSystem::Initialize(void)" (?Initialize@WindowSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_GetWindowSize referenced in function "public: virtual void __thiscall WindowSystem::TransmitMessage(class std::shared_ptr<class Message>)" (?TransmitMessage@WindowSystem@@UAEXV?$shared_ptr@VMessage@@@std@@@Z)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_MinimizeWindow referenced in function "public: virtual void __thiscall WindowSystem::TransmitMessage(class std::shared_ptr<class Message>)" (?TransmitMessage@WindowSystem@@UAEXV?$shared_ptr@VMessage@@@std@@@Z)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_GetWindowSurface referenced in function "public: virtual void __thiscall WindowSystem::Initialize(void)" (?Initialize@WindowSystem@@UAEXXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_DestroyWindow referenced in function "public: virtual int __thiscall WindowSystem::Release(void)" (?Release@WindowSystem@@UAEHXZ)
10>Windows.lib(Windows.obj) : error LNK2019: unresolved external symbol _SDL_ShowSimpleMessageBox referenced in function "private: void __thiscall WindowSystem::ErrorPopUp(class std::shared_ptr<class ErrorMessage> const &)" (?ErrorPopUp@WindowSystem@@AAEXABV?$shared_ptr@VErrorMessage@@@std@@@Z)
10>A:\Mercurial\CodeFish\Build\AntTweakDebugWin32\Game.exe : fatal error LNK1120: 32 unresolved externals
現時点で懸念している主な問題は、Handle クラス内の演算子 bool の LNK2019 です。参考までに、クラス全体を次に示します。
template <class TYPE>
class Handle;
template <class TYPE_TO_CAST_TO, class TYPE_TO_CAST_FROM>
Handle<TYPE_TO_CAST_TO> static_handle_cast(Handle<TYPE_TO_CAST_FROM> const& subject);
template <class TYPE>
class Handle : public HandleRegistrar
{
// friend all Handles so that we may convert them
template<class U> friend class Handle;
template<class T, class U> friend Handle<T> static_handle_cast(Handle<U> const& subject);
private:
bool m_weak;
int* m_ref_count;
TYPE** m_ptr;
public:
void destruct(void);
int use_count(void) const;
bool expired(void) const;
void swap(Handle<TYPE>& rhs);
TYPE* get(void);
TYPE* get(void) const;
template<typename TYPE2> Handle<TYPE>& operator=(const Handle<TYPE2>& rhs);
Handle<TYPE>& operator=(const Handle<TYPE>& rhs);
template<typename TYPE2> Handle<TYPE>& operator=(TYPE2* rhs);
TYPE* operator->(void);
TYPE* operator->(void) const;
TYPE& operator*(void);
TYPE& operator*(void) const;
bool operator==(const Handle<TYPE>& rhs);
void operator%(Handle<TYPE>& rhs);
operator bool(void) const;
public:
~Handle(void);
Handle(const Handle<TYPE>& rhs, bool weak = false);
template<typename TYPE2> Handle(const Handle<TYPE2>& rhs, bool weak = false);
Handle(TYPE& object_to_point_at, bool weak = false);
Handle(TYPE*&& pointer_to_object, bool weak = false);
Handle(void);
};
Handle クラスの .cpp ファイルには実装がありません。完全にヘッダーに実装されています。私はしばらくの間、この問題の解決策を探していましたが、この問題について何かを見つけたいと思って、SO に関する非常に多くの LNK2019 記事を調べました...何が起こっているのかについての支援や洞察をいただければ幸いです。私たちのゲーム プロジェクトでは多くのことが行われているので、さらに情報が必要な場合は提供します。
プロジェクトについて: -
静的にリンクされたコードは、11 のライブラリに分散されています。
-プリコンパイル済みヘッダーが使用されます。