eclipse 我如何获得 crtdbg.h 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12685202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:07:22  来源:igfitidea点击:

How do I get crtdbg.h file?

c++eclipsemingw

提问by 2607

I am using MinGWGCC + Eclipseon Windows, and I have run into this error:

我在 Windows 上使用MinGWGCC + Eclipse,但遇到了这个错误:

C:\Program Files\ITG Derivatives LLC\api_clear-2.0.2.48\include/windows/csassert.h:12:20: fatal error crtdbg.h No such file or directory

C:\Program Files\ITG Derivatives LLC\api_clear-2.0.2.48\include/windows/csassert.h:12:20: 致命错误 crtdbg.h 没有那个文件或目录

What is the crtdbg.hfile? How can I get it and solve this problem?

crtdbg.h文件是什么?我怎样才能得到它并解决这个问题?

回答by Bhavik Ambani

<crtdbg.h>is a Microsoft Visual C++ specific header. You may be able to work around this problem using a stub similar to the following:

<crtdbg.h>是 Microsoft Visual C++ 特定的标头。您可以使用类似于以下内容的存根解决此问题:

#ifdef _MSC_VER
#include <crtdbg.h>
#else
#define _ASSERT(expr) ((void)0)

#define _ASSERTE(expr) ((void)0)
#endif

Note that this will disable any asserts in the code you are compiling against, and still won't help you if the code you're compiling uses more advanced features inside crtdbg.h, such as memory leak detection. If these features are in use, you will need to compile the code with MSVC++ rather than MinGW.

请注意,这将禁用您正在编译的代码中的任何断言,如果您正在编译的代码使用了更高级的功能crtdbg.h,例如内存泄漏检测,则仍然无济于事。如果正在使用这些功能,您将需要使用 MSVC++ 而不是 MinGW 来编译代码。

回答by James Drinkard

I ran into this exact same issue, but with Visual Studio Community Edition 2019.

我遇到了完全相同的问题,但使用 Visual Studio Community Edition 2019。

The solution was to download the Windows 10 SDK using the Visual Studio installer. Once I did that the next compile worked fine.

解决方案是使用 Visual Studio 安装程序下载 Windows 10 SDK。一旦我这样做了,下一个编译就可以正常工作。

回答by JHEK

I ran into this exact same issue, but with Visual Studio Code. First start/restart VS Installer and install the Win10 SDK. Then restart your computer and the needed heasers are available.

我遇到了这个完全相同的问题,但是使用 Visual Studio Code。首先启动/重启VS Installer并安装Win10 SDK。然后重新启动您的计算机,所需的 heasers 就可用了。