c++ - 更新 Visual Studio 2017,现在出现编译错误 C7510:“回调”:使用依赖模板名称必须以“模板”为前缀
问题描述
在更新(15.8.0)之后,我尝试像往常一样编译我的项目。我将 showincludes 设置为 yes 以找出错误的来源,但它都是系统代码。从 stdafx.cpp 开始,它会遍历所有包含和错误:
1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\pshpack8.h 1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\poppack.h 1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\pshpack8.h 1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\poppack.h 1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt\wrl\event.h 1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt\eventtoken.h 1>Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\pshpack8.h 1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\winrt\wrl\event.h(316): error C7510: 'Callback': use of dependent template name must be prefixed with 'template' 1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\winrt\wrl\event.h(324): error C7510: 'Callback': use of dependent template name must be prefixed with 'template'
有没有人见过这个?我在谷歌上下搜索以找到无济于事的答案。缺少修改windows sdk,不知道该怎么做。
编辑:在我安装的 Windows SDK 中,错误出现在文件中 -
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt\wrl\event.h
更改第 316 行:返回 DelegateHelper::Traits::Callback(Details::Forward(callback));
to: return DelegateHelper::Traits::template Callback(Details::Forward(callback));
和第 324 行:返回 DelegateHelper::Traits::Callback(
返回 DelegateHelper::Traits::template Callback(Details::Forward(callback));
由于修改 sdk 并不是真正的解决方案,Peng Du 在配置窗口中选择 nonconformance 的解决方案是可行的方法。
解决方案
我有遗留项目,我并排比较了项目设置,最后我通过设置成功构建了新项目:Configuration Properties
>>>C/C++
Language
Conformance mode = No
推荐阅读
- jquery - 请求 AJAX 失败
- reactjs - React,Redux - 将功能从组件 A 传递给其他组件
- regex - jsonPath 表达式预期值但返回值列表
- python - 不同的 PCA 图
- python - 从带框字段输入的表单中提取字符
- vb.net - Vb.Net DataGridView 代码错误 - 对象引用未设置为对象的实例
- random - R 插入符号:在不同机器上使用并行 rfe 完全可重现的结果
- python-2.7 - 如何在python中准备多级多值训练数据集
- python - 重新格式化 Dataframe 列,以便将任何数字月份子字符串替换为月份字符串
- angular - 关于点击重定向的 Ionic 4 firebase 通知不适用于 this.ngZone.run(()