即使我已包含Windows.h,也将BYTE作为未声明的标识符 [英] BYTE as undeclared identifier even though I have included windows.h
本文介绍了即使我已包含Windows.h,也将BYTE作为未声明的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码如下
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
BYTE* pAlloc1 = NULL;
return 0;
}
创建以下错误。
错误C2065:'BYTE':未声明的标识符
error C2065: 'BYTE' : undeclared identifier
我在这里做什么错了?
推荐答案
您有 #include stdafx.h
您使用的是预编译头文件。如果您使用预编译的标头,则在预编译的标头之前的所有内容都将被丢弃。
You have #include "stdafx.h"
, which usually means that you're using a precompiled header. If you use a precompiled header, anything preceding the precompiled header will be discarded.
尝试重新排序 #include
行因此, stdafx.h
是第一个。 (或将 stdafx.h
更改为 #include< windows.h>
,通常将其放在常用的系统标题。)
Try reordering your #include
lines so that "stdafx.h"
is first. (Or change stdafx.h
to #include <windows.h>
, which is generally where you want to put commonly-used system headers.)
这篇关于即使我已包含Windows.h,也将BYTE作为未声明的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文