带标头单元的宏重新定义

发布于 2025-02-07 04:40:36 字数 595 浏览 3 评论 0原文

我正在尝试使用标头单元。目前,我正在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

っ左 2025-02-14 04:40:36

在使用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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文