错误 C2039 "wait_for": 不是 "winrt::impl" 的成员 C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt\impl\Windows.Foundation.0.h 983
vs2019 编译 winrt,报错,"wait_for" is not member of "winrt::impl",错误的中文描述是"wait_for": 不是 "winrt::impl" 的成员
windows sdk 版本 10.0.19041.0
解决办法:
方法 一:
把符合模式改为 否 (/permissive),然后重新编译,就不会有winrt::imp的报错了
工程文件xxxx.vcxproj中的字段是 <ConformanceMode>true</ConformanceMode>
为啥呢?请搜索,符合模式premissive,了解一下这个字段的含义
参考:
https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47
方法二:
windows sdk中winrt相关的文件旧了,不符合premissive的安全检查了,需要用新的CppWinRT
vs2019工具中Nuget包管理中,搜索 Microsoft.Windows.CppWinRT,下载安装就行