Upgrading VS2017 from 15.4.1 to 15.5.1 resulted in build error(将 VS2017 从 15.4.1 升级到 15.5.1 导致构建错误)
问题描述
我正在使用以下工具/版本进行编程:Windows 10/VS2017 Professional/C++
升级到 15.5.1 后出现以下错误:
<块引用>MIDL2338:开关是矛盾的 - no_robust 与 - 目标
Microsoft 编译器错误描述列表显示:编译 IDL 文件时,不能同时使用/osf 和/ms_ext 命令行开关.
我的项目属性中没有指定这些开关.
我尝试降级回 15.4.1,但发现无法恢复到旧版本,除非它是 N-1.这是基于我读过的许多博客(包括 Stack Overflow).
我碰壁了,一直处于停滞状态,直到我弄清楚这个开关问题.
非常感谢您的帮助.
我刚才遇到了同样的问题,但幸运的是我可以访问另一个更旧的安装.
这里是VS 2017 15.4.4下的命令行:
/iid RtdHandleServer_i.c"/env win32/h RtdHandleServer.h"/W1/char 签名/tlb Win32ReleaseRtdHandleServer.tlb"/oicf/DNDEBUG"/no_robust/nologo/proxy RtdHandleServer_p.c"
这是在 VS 2017 15.5.1 下更改为的内容:
/iid RtdHandleServer_i.c"/env win32/h RtdHandleServer.h"/W1/char 签名/tlb Win32ReleaseRtdHandleServer.tlb"/oicf/目标NT60"/DNDEBUG"/no_robust/nologo/proxy RtdHandleServer_p.c"
所以所有的改变是添加了一个新参数/target "NT60",大概是作为一个新的默认值.
在我看来有两种方法可以解决这个问题:
- 在 idl 文件的属性页"对话框中,转到配置属性">中度>进阶,明确最小目标系统"的价值.
- 去掉 -no_robust 标志.根据文档(https://msdn.microsoft.com/en-us/library/windows/desktop/aa367349%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396):
<块引用>
如果生成的存根需要在 Microsoft Windows NT、Windows 95/98 或 Windows Me 上运行,则必须使用/no_robust 命令行开关来禁用/robust 功能."
就消除错误而言,任何一种更改都对我有效,但第一种方法的影响最小.
PS.我认为 MS 错误描述 (https://msdn.microsoft.com/en-us/library/windows/desktop/aa366756%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396) 在这种情况下可能不正确.您看到的原始错误消息是指两个特定标志,/no_robust 和 /target,而不是 /osf 和 /ms_ext.
注意: MIDL 编译器 /robust
开关执行以下操作(微软文档 MIDL 编译器:/robust 开关)
使用 /robust
开关生成额外的信息,允许网络数据表示 (NDR) 引擎执行运行时错误检查动态数组、联合和输入输出中的相关参数DCOM 应用程序中的接口指针./robust 开关仅在 Windows 2000 和更高版本的 Windows 下可用.
I'm programming with the following tools/versions: Windows 10 / VS2017 Professional / C++
After I upgraded to 15.5.1 I got the following error:
MIDL2338: switches are contradictory - no_robust vs. - 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.
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. This is based on the many blogs I've read (including 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:
/iid "RtdHandleServer_i.c" /env win32 /h "RtdHandleServer.h" /W1 /char signed /tlb "Win32ReleaseRtdHandleServer.tlb" /Oicf /D "NDEBUG" /no_robust /nologo /proxy "RtdHandleServer_p.c"
Here is what it is changed to under VS 2017 15.5.1:
/iid "RtdHandleServer_i.c" /env win32 /h "RtdHandleServer.h" /W1 /char signed /tlb "Win32ReleaseRtdHandleServer.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.
It looks to me as if there are two ways to address this:
- In the Property Pages dialog for the idl file, go to Configuration Properties > MIDL > Advanced, and clear the value of "Minimum Target System".
- Get rid of the -no_robust flag. According to the documentation (https://msdn.microsoft.com/en-us/library/windows/desktop/aa367349%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396):
"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."
Either change works for me in terms of getting rid of the error, but the first method has the least impact.
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. The original error message that you are seeing refers to two specific flags, /no_robust and /target, not to /osf and /ms_ext.
Note: The MIDL compiler /robust
switch does the following (Microsoft docs MIDL compiler: /robust switch)
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. The /robust switch is only available under Windows 2000 and later versions of Windows.
这篇关于将 VS2017 从 15.4.1 升级到 15.5.1 导致构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 VS2017 从 15.4.1 升级到 15.5.1 导致构建错误
基础教程推荐
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 从 std::cin 读取密码 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01