我如何获得crtdbg.h文件?

260*_*607 5 c++ eclipse mingw

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

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

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

Bha*_*ani 13

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

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

#define _ASSERTE(expr) ((void)0)
#endif
Run Code Online (Sandbox Code Playgroud)

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


Jam*_*ard 6

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

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

  • 在尝试上述解决方案之前,绝对值得先检查一下。 (5认同)