C++/WinRT 库支持
C++/WinRT Library support
c++/WinRT 是否支持 c++ static/dynamic 库?
我有一个 c++ 静态库,我试图将其添加为 c++/winrt 项目中的参考,但 VS 说项目不受支持!
我的 VS 版本 :: Microsoft Visual Studio Enterprise 2019
版本 16.4.5
我是如何尝试添加参考的:
- 右击我的项目->添加->引用
- Select 添加参考中的 c++ 库项目 window
然后显示不支持项目的警告对话框。请看附图
从这个document,它提到
If you just try to add a reference from a Universal Windows Project to
a classic desktop library, you get an error message that says the
library is not compatible. In the case of a static library, you can
link to your library simply by adding the library (.lib file) to your
linker input.
不要在解决方案资源管理器的引用节点中添加引用。该机制仅适用于 Windows 运行时组件。
所以你需要右击你的c++/winrt项目,选择Configuration Properties > Linker > Input 然后在中添加库的路径附加依赖项。然后将头文件包含到您的 pch.h 或 .cpp 文件中。
具体步骤可以参考here。
c++/WinRT 是否支持 c++ static/dynamic 库?
我有一个 c++ 静态库,我试图将其添加为 c++/winrt 项目中的参考,但 VS 说项目不受支持!
我的 VS 版本 :: Microsoft Visual Studio Enterprise 2019 版本 16.4.5
我是如何尝试添加参考的:
- 右击我的项目->添加->引用
- Select 添加参考中的 c++ 库项目 window
然后显示不支持项目的警告对话框。请看附图
从这个document,它提到
If you just try to add a reference from a Universal Windows Project to a classic desktop library, you get an error message that says the library is not compatible. In the case of a static library, you can link to your library simply by adding the library (.lib file) to your linker input.
不要在解决方案资源管理器的引用节点中添加引用。该机制仅适用于 Windows 运行时组件。
所以你需要右击你的c++/winrt项目,选择Configuration Properties > Linker > Input 然后在中添加库的路径附加依赖项。然后将头文件包含到您的 pch.h 或 .cpp 文件中。
具体步骤可以参考here。