问题描述
您好,
昨天我将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.
感谢您的时间和帮助。
推荐答案
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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!