带标头单元的宏重新定义
我正在尝试使用标头单元。目前,我正在Visual Studio 2022(版本17.2.3)中进行测试。
我目前正在导入多个标头单元,例如
import <windows.h>;
import <thread>;
警告 警告c4005:'__ Analsisy_assume':宏重新定义1&gt; c:\ program files(x86)\ Windows Kits \ 10 .22621.0 \ shared \ specstrings_strict.h(933):消息:请参阅“ __ Analsys_Assume'
的上一个定义
,因为如果&lt>&lt; thread&gt; gt;
and code> and code>&windows &lt; windows &lt; .h&gt; 通常具有任何共享标题,通常曾经包含后卫或巴格马会阻止它们被包括在内并被乘以乘法。
我不确定标题单元与宏共享标头文件,大多数外部库中使用的标头文件都可以使用。
我敢肯定我可以忽略警告,但是我很好奇是否有人有更好的解决方案。
I'm experimenting with header units. Currently, I'm testing in Visual Studio 2022(Version 17.2.3).
I'm currently importing multiple header units, for example
import <windows.h>;
import <thread>;
warning warning C4005: '__analysis_assume': macro redefinition 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\specstrings_strict.h(933): message : see previous definition of '__analysis_assume'
It kind of make senses because if <thread>
and <windows.h>
have any shared headers normally the inclusion guards or pragma once would prevent them from being included and being multiply defined.
I'm not really sure how header units can work if they shared header files with macros which a majority of header files of external libraries use.
I'm sure I can ignore the warning but I'm curious if anyone else has a better solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在使用Windows.h时,这似乎是导致多个宏重新定义的导入的已知问题。
nofollow noreferrer“警告-C4005:-OUTPTR:-MACRO-REDEFINIT/1546919
我们将不得不等待Microsoft解决此问题。
It seems this is a known issue with import causing multiple macro redefinitions when using windows.h.
https://developercommunity.visualstudio.com/t/warning-C4005:-Outptr:-macro-redefinit/1546919
We will have to wait for Microsoft to address this issue.