#include < Dbghelp.h> 不包含标头
#include <Dbghelp.h> doesn't include the header
例如,如果在控制台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 链接到"项目设置">链接器>输入>"其他依赖项"。
相关文章:
- 在CMake中使用find_package时,是否会显式包含标头
- GCC 包含标头(使用"-include")CMake 未检测到的更改
- 使用预处理指令检查是否包含标头?
- 更智能地在C++中包含保护,以便在不同的命名空间中多次包含标头
- 如何在 c++ 中有条件地包含标头?
- main.cpp 如何知道包含标头的源文件?
- 有没有办法告诉 g++ 编译器,而不是在某个 -I 路径中查找包含标头
- QT 如何包含标头和 cpp 文件
- 在 c++ 中,如果包含标头,为什么我会收到'does not a name of type'错误?
- CLion 无法解析类型 std::unordered_map,即使它提示我包含标头并且编译工作
- 是否可以链接到,包括和使用静态库,而无需额外包含标头/文件
- 为什么包含标头会导致"use of auto before deduction of auto"错误?
- 如何告诉qmake在从dbus xml生成文件时包含标头
- GCC Bug,使用尖括号通过宏包含标头时"linux"路径中的字符串"<>"替换为 "1"
- 如何从平台SDK明确包含标头文件
- 包含标头中的搜索路径因编译器而异
- #include < Dbghelp.h> 不包含标头
- 在 main.cpp 以外的文件中包含标头时出现链接器错误
- 尽管包含标头,G++ 链接器仍无法找到函数
- 如何防止在标题中包含标头,以最大程度地减少包含在其他 CPP 中