例如,如果在控制台#include <Dbghelp.h>应用程序中包含C++,它将不会从头文件中引入任何定义,并且存在或多或少类似的编译器错误,就好像根本没有包含该头一样。
编译器错误如下所示:
1>------ Build started: Project: ConsoleDump, Configuration: Debug Win32 ------
1> ConsoleDump.cpp
1>e:\projects\vs2015 projects\consoledump\consoledump\consoledump.cpp(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\projects\vs2015 projects\consoledump\consoledump\consoledump.cpp(23): error C2146: syntax error: missing ';' before identifier 'Flags'
1>e:\projects\vs2015 projects\consoledump\consoledump\consoledump.cpp(23): error C2065: 'Flags': undeclared identifier
1>e:\projects\vs2015 projects\consoledump\consoledump\consoledump.cpp(23): error C2065: 'MiniDumpWithFullMemory': undeclared identifier
1>e:\projects\vs2015 projects\consoledump\consoledump\consoledump.cpp(24): error C2065: 'MiniDumpWithFullMemoryInfo': undeclared identifier
1>e:\projects\vs2015 projects\consoledump\consoledump\consoledump.cpp(25): error C2065: 'MiniDumpWithHandleData': undeclared identifier
1>e:\projects\vs2015 projects\consoledump\consoledump\consoledump.cpp(26): error C2065: 'MiniDumpWithUnloadedModules': undeclared identifier
1>e:\projects\vs2015 projects\consoledump\consoledump\consoledump.cpp(27): error C2065: 'MiniDumpWithThreadInfo': undeclared identifier出什么问题了?
发布于 2017-04-07 17:27:02
您必须在<windows.h>之前包含<DbgHelp.h>,如果项目使用"Stdafx.h",则必须将其包含在其他所有内容之前。以下是正确的顺序:
#include "stdafx.h"
#include <windows.h>
#include <Dbghelp.h>还要确保将DbgHelp.lib链接到“项目设置”>链接器>输入>“附加依赖项”。
https://stackoverflow.com/questions/43283925
复制相似问题