更新MVS 2017到版本15.9.11后出现C2440错误 [英] C2440 error appears after update MVS 2017 to Version 15.9.11

查看:97
本文介绍了更新MVS 2017到版本15.9.11后出现C2440错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好, 

昨天我将MVS升级到更新版本。突然间,我开始遇到数百个编译器错误,如下所示:

Yesterday I upgraded my MVS to a more recent version. Suddenly I started to have hundreds of compiler errors like the following:

错误C2440:'static_cast':无法转换为'const wchar_t ...

error C2440: 'static_cast': cannot convert from 'const wchar_t ...

我尝试了与Zc相关的所有内容:strictStrings但没有任何作用。 

I tried everything related to Zc:strictStrings but nothing works. 

错误来自我几个月来成功使用的一些标题。

The errors are coming from some headers that I have been successfully using for months.

感谢您的时间和帮助。

推荐答案

我们不知道编译器在您的标题中看到了什么,但是以下生成了C2440错误 -

We don't know what the compiler is seeing in your headers, but the following generated the C2440 error -

wchar_t *p = static_cast<wchar_t*>(L"String Literal");

在我的VS2017(15.9.11)副本中,通过在编译器命令行的Project属性页面中设置/ Zc:strictStrings-选项来消除错误附加选项 如所示(对于每个平台/配置,根据需要)  -

In my copy of VS2017 (15.9.11) the error was eliminated by setting the /Zc:strictStrings- option in the Project property page for the compiler command line Additional Options  as indicated (for each platform/configuration as needed)  -


这篇关于更新MVS 2017到版本15.9.11后出现C2440错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆