问题描述:
VC++程序编译时提示错误:error C2065: “HANDLE”: 未声明的标识符等众多错误提示,如下所示:
error C2065: “HANDLE”: 未声明的标识符
error C2146: 语法错误: 缺少“;”(在标识符“hFind”的前面)
error C2065: “hFind”: 未声明的标识符
error C2065: “INVALID_HANDLE_VALUE”: 未声明的标识符
error C2065: “WIN32_FIND_DATA”: 未声明的标识符
error C2146: 语法错误: 缺少“;”(在标识符“fdata”的前面)
error C2065: “fdata”: 未声明的标识符
error C2065: “hFind”: 未声明的标识符
error C2065: “fdata”: 未声明的标识符
error C3861: “FindFirstFile”: 找不到标识符
error C2065: “hFind”: 未声明的标识符
error C2065: “INVALID_HANDLE_VALUE”: 未声明的标识符
error C2065: “fdata”: 未声明的标识符
error C2228: “.cFileName”的左边必须有类/结构/联合
查找了一下所对应的头文件为winbase.h,自然就添加上去了:
#include <winbase.h>
但是当添加winbase.h后又提示winbase.h(243): error C2146: 语法错误: 缺少“;”(在标识符“Internal”的前面)等众多错误提示,如下所示:
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“Internal”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“InternalHigh”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“Offset”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“OffsetHigh”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“Pointer”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“hEvent”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“lpCompletionKey”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“Internal”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“dwNumberOfBytesTransferred”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“nLength”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C2146: 语法错误: 缺少“;”(在标识符“lpSecurityDescriptor”的前面)
>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winbase.h(): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
解决办法:
将#include <winbase.h>替换成#include<windows.h>就行了。
#include<windows.h>