[英]Upgrading VS2017 from 15.4.1 to 15.5.1 resulted in build error
I'm programming with the following tools/versions: Windows 10 / VS2017 Professional / C++我正在使用以下工具/版本进行编程:Windows 10 / VS2017 Professional / C++
After I upgraded to 15.5.1 I got the following error:升级到 15.5.1 后,出现以下错误:
MIDL2338: switches are contradictory - no_robust vs. - target
MIDL2338:开关是矛盾的 - no_robust 与 - target
The Microsoft compiler error description list says: You cannot use both the /osf and /ms_ext command-line switches when you compile an IDL file. Microsoft 编译器错误描述列表说:编译 IDL 文件时不能同时使用 /osf 和 /ms_ext 命令行开关。
None of those switches are specified in my project properties.这些开关都没有在我的项目属性中指定。
I tried to downgrade back to 15.4.1 but have found that it's impossible to revert to an old version unless it's N-1.我试图降级回 15.4.1,但发现除非是 N-1,否则无法恢复到旧版本。 This is based on the many blogs I've read (including Stack Overflow).
这是基于我读过的许多博客(包括 Stack Overflow)。
I have hit a wall and am at a standstill until I figure out this switch issue.在我弄清楚这个开关问题之前,我遇到了困难并且处于停顿状态。
Your help would be greatly appreciated.非常感谢您的帮助。
I ran into the same problem just now, but luckily I do have access to another, older, installation.我刚才遇到了同样的问题,但幸运的是我可以访问另一个更旧的安装。
Here is the command line under VS 2017 15.4.4:这是VS 2017 15.4.4下的命令行:
/iid "RtdHandleServer_i.c" /env win32 /h "RtdHandleServer.h" /W1 /char signed /tlb "Win32\Release\RtdHandleServer.tlb" /Oicf /D "NDEBUG" /no_robust /nologo /proxy "RtdHandleServer_p.c"
Here is what it is changed to under VS 2017 15.5.1:这是在 VS 2017 15.5.1 下更改为的内容:
/iid "RtdHandleServer_i.c" /env win32 /h "RtdHandleServer.h" /W1 /char signed /tlb "Win32\Release\RtdHandleServer.tlb" /Oicf /target "NT60" /D "NDEBUG" /no_robust /nologo /proxy "RtdHandleServer_p.c"
So all that has changed is that a new parameter /target "NT60" has been added, presumably as a new default.所以所有改变的是添加了一个新参数/target "NT60" ,大概是作为一个新的默认值。
It looks to me as if there are two ways to address this:在我看来,好像有两种方法可以解决这个问题:
"The /no_robust command line switch must be used to disable the /robust feature if generated stubs need to run on Microsoft Windows NT, Windows 95/98, or Windows Me."
“如果生成的存根需要在 Microsoft Windows NT、Windows 95/98 或 Windows Me 上运行,则必须使用 /no_robust 命令行开关来禁用 /robust 功能。”
Either change works for me in terms of getting rid of the error, but the first method has the least impact.就消除错误而言,任何一种更改都对我有用,但第一种方法的影响最小。
PS. PS。 I think that the MS error description ( https://msdn.microsoft.com/en-us/library/windows/desktop/aa366756%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 ) is likely to be incorrect in this instance.
我认为 MS 错误描述( https://msdn.microsoft.com/en-us/library/windows/desktop/aa366756%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 )可能在这种情况下是不正确的。 The original error message that you are seeing refers to two specific flags, /no_robust and /target , not to /osf and /ms_ext .
您看到的原始错误消息是指两个特定标志/no_robust和/target ,而不是/osf和/ms_ext 。
Note: The MIDL compiler /robust
switch does the following ( Microsoft docs MIDL compiler: /robust switch )注意: MIDL 编译器
/robust
开关执行以下操作( Microsoft 文档 MIDL 编译器:/robust 开关)
Using the
/robust
switch generates additional information that allows the Network Data Representation (NDR) engine to perform run-time error checking on correlated arguments in dynamic arrays, unions, and in out interface pointers in DCOM applications.使用
/robust
开关会生成允许网络数据表示 (NDR) 引擎对动态数组、联合和 DCOM 应用程序中的 in out 接口指针中的相关参数执行运行时错误检查的附加信息。 The /robust switch is only available under Windows 2000 and later versions of Windows./robust 开关仅在 Windows 2000 和更高版本的 Windows 下可用。
In order to remove the /no_robust
flag (if generated stubs don't need to be run on Microsoft Windows NT, Windows 95/98, or Windows Me), simply remove the为了删除
/no_robust
标志(如果生成的存根不需要在 Microsoft Windows NT、Windows 95/98 或 Windows Me 上运行),只需删除
<ValidateAllParameters>false</ValidateAllParameters>
entries under the <Midl>
element in the .vcxproj
files. .vcxproj
文件中<Midl>
元素下的条目。
One more reference answer for MIDL2338 vs MIDL1024 errors. MIDL2338 与 MIDL1024 错误的另一个参考答案。 https://developercommunity.visualstudio.com/t/build-fails-from-from-msbuild-command-line-with-er/207580
https://developercommunity.visualstudio.com/t/build-fails-from-from-msbuild-command-line-with-er/207580
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.