首页 > 解决方案 > 将 IDXGIAdapter1 转换为 IDXGIAdapter4 时出现链接错误 [DirectX 和 WinRT/C++]

问题描述

我正在尝试将 IDXGIAdapter1 实例转换为 IDXGIAdapter4,如下所示:

winrt::com_ptr<IDXGIAdapter1> adapter;

winrt::com_ptr<IDXGIAdapter4> adapter{adapters.front().as<IDXGIAdapter4>()};

但是有链接错误:

错误 LNK2019:函数“public: __cdecl winrt::hresult_error::hresult_error(struct winrt::hresult,struct winrt::hresult_error::from_abi_t)”中引用的未解析外部符号 WINRT_GetRestrictedErrorInfo (??0hresult_error@winrt@@QEAA@Uhresult@ 1@Ufrom_abi_t@01@@Z) 错误 LNK2019:无法解析的外部符号 WINRT_RoOriginateLanguageException 在函数“private: void __cdecl winrt::hresult_error::originate(struct winrt::hresult,void *)”中引用 (?originate@hresult_error@winrt@ @AEAAXUhresult@2@PEAX@Z)

我究竟做错了什么?

标签: c++directxc++-winrt

解决方案


我通过链接“RuntimeObject.lib”库解决了这个问题。感谢您的帮助,Faywang - MSFT。


推荐阅读