gpt4 book ai didi

c++ - 尝试使用 DirectXTK 创建 GamePad 时出现错误 LNK2019

转载 作者:行者123 更新时间:2023-11-27 22:51:51 33 4
gpt4 key购买 nike


我正在关注 DirectXTK GamePad tutorial关于如何将 GamePad 整合到我的应用程序中,但我在尝试创建 GamePad 时遇到了一个errorLNK2019

到目前为止,我已经:

  • GamePad.h 包含到我的 Controller 头文件中

  • 已添加

    std::unique_ptr<DirectX::GamePad> mGamePad;

    在我的 Controller 类

  • 在 Controller::Init() 中添加

    mGamePad = std::make_unique<GamePad>();

当我添加最后一行代码时出现错误(很长):

DirectXTK.lib(GamePad.obj) : error LNK2019: unresolved external symbol __imp_RoGetActivationFactory referenced in function "long __cdecl ABI::Windows::Foundation::GetActivationFactory<struct ABI::Windows::Gaming::Input::IGamepadStatics>(struct HSTRING__ *,struct ABI::Windows::Gaming::Input::IGamepadStatics * *)" (??$GetActivationFactory@UIGamepadStatics@Input@Gaming@Windows@ABI@@@Foundation@Windows@ABI@@YAJPEAUHSTRING__@@PEAPEAUIGamepadStatics@Input@Gaming@12@@Z)
DirectXTK.lib(GamePad.obj) : error LNK2019: unresolved external symbol WindowsCreateStringReference referenced in function "private: void __cdecl Microsoft::WRL::Wrappers::HStringReference::CreateReference(wchar_t const *,unsigned int,unsigned int)" (?CreateReference@HStringReference@Wrappers@WRL@Microsoft@@AEAAXPEB_WII@Z)
fatal error LNK1120: 2 unresolved externals

在我的应用程序中,我已经使用了 SpriteBatch没有任何问题,所以我猜当我包含 DirectXTK 时我已经做了所有正确的事情到我的解决方案。

我还尝试使用

创建 GamePad
mGamePad.reset( new GamePad() );

我在 older version 中找到的教程。

另外.. Controller 插入..关于我做错了什么的任何建议?谢谢!

最佳答案

您必须将您的项目与 RuntimeObject.lib 链接

关于c++ - 尝试使用 DirectXTK 创建 GamePad 时出现错误 LNK2019,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36434790/

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