[英]C2337 'importidl': attribute not found error after upgrading solution to VS2019 ( 16.9.2 )
I am updating a project to compile with VS2019 and turns out that importidl is no longer supported in VS2019 ( 16.9.2 ).我正在更新一个项目以使用 VS2019 编译,结果发现VS2019 ( 16.9.2 ) 不再支持 importidl 。 Comparing the generated.tlb prior to updating to VS2019 and after the binary file is much smaller resulting in a broken COM interface.在更新到 VS2019 之前和之后比较生成的.tlb 二进制文件要小得多,从而导致 COM 接口损坏。
The error I am getting is C2337 'importidl':attribute not found
.我得到的错误是C2337 'importidl':attribute not found
。
The importidl
is surrounded by a warning suppression: importidl
被警告抑制包围:
#pragma warning(disable: 4467)
[ importidl(COM\\dummy.idl) ];
#pragma warning(pop)
C4467: usage of ATL attribute is deprecated
The Microsoft documentation leads to believe that imporidl
had not been deprecated or removed. Microsoft 文档导致人们相信imporidl
没有被弃用或删除。 However, it has been last updated 2 years ago and the warnings and errors are leading me to believe that there is a discrepancy on the documentation.然而,它最近一次更新是在 2 年前,警告和错误让我相信文档存在差异。
What is the alternative to go around the removed importidl
?删除的 importidl 周围importidl
的替代品是什么?
In order to fix this issue with VS2019, I added a /permissive
flag to the command line option.为了解决 VS2019 的这个问题,我在命令行选项中添加了/permissive
标志。 Setting the conformance mode to "No" along with the std:c++latest
did not work.将一致性模式设置为“否”以及std:c++latest
不起作用。 std:c++latest
is probably overriding /permissive
. std:c++latest
可能会覆盖/permissive
。
Keeping the conformance mode to Default
, with the latest /std:c++latest
language standard and adding /permissive
as an additional Options to the command line property goes around the error C2017 Importidl attribute not found
.将一致性模式保持为Default
,使用最新的/std:c++latest
语言标准并将/permissive
作为附加选项添加到命令行属性可以绕过错误C2017 Importidl attribute not found
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.