#include < Dbghelp.h> 不包含标头

#include <Dbghelp.h> doesn't include the header

本文关键字:包含标 gt Dbghelp lt #include      更新时间:2023-10-16

例如,如果在控制台C++应用程序中包含#include <Dbghelp.h>,它不会从头文件中引入任何定义,并且或多或少存在类似的编译器错误,就好像根本不包含此标头一样。

编译器错误如下所示:

1>------ Build started: Project: ConsoleDump, Configuration: Debug Win32 ------
1>  ConsoleDump.cpp
1>e:projectsvs2015 projectsconsoledumpconsoledumpconsoledump.cpp(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:projectsvs2015 projectsconsoledumpconsoledumpconsoledump.cpp(23): error C2146: syntax error: missing ';' before identifier 'Flags'
1>e:projectsvs2015 projectsconsoledumpconsoledumpconsoledump.cpp(23): error C2065: 'Flags': undeclared identifier
1>e:projectsvs2015 projectsconsoledumpconsoledumpconsoledump.cpp(23): error C2065: 'MiniDumpWithFullMemory': undeclared identifier
1>e:projectsvs2015 projectsconsoledumpconsoledumpconsoledump.cpp(24): error C2065: 'MiniDumpWithFullMemoryInfo': undeclared identifier
1>e:projectsvs2015 projectsconsoledumpconsoledumpconsoledump.cpp(25): error C2065: 'MiniDumpWithHandleData': undeclared identifier
1>e:projectsvs2015 projectsconsoledumpconsoledumpconsoledump.cpp(26): error C2065: 'MiniDumpWithUnloadedModules': undeclared identifier
1>e:projectsvs2015 projectsconsoledumpconsoledumpconsoledump.cpp(27): error C2065: 'MiniDumpWithThreadInfo': undeclared identifier
出了

什么问题?

你必须

<DbgHelp.h>之前包含<windows.h>,如果项目使用"Stdafx.h",则必须在所有其他内容之前包含它。以下是正确的顺序:

#include "stdafx.h"
#include <windows.h>
#include <Dbghelp.h>

还要确保将 DbgHelp.lib 链接到"项目设置">链接器>输入>"其他依赖项"。