问题
My code is as follows
// 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;
}
creating following errors.
error C2065: 'BYTE' : undeclared identifier
What am I doing wrong here?
回答1:
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.
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.)
来源:https://stackoverflow.com/questions/24900083/byte-as-undeclared-identifier-even-though-i-have-included-windows-h