我正在使用此声明移植标头:
struct tMaterialInfo {
char strName[255]; // the texture name
char strFile [255]; // the texture
BYTE color [3]; // the color of the object
};
Run Code Online (Sandbox Code Playgroud)
标题包含以下内容:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <fstream>
#include <vector>
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include<gl\glu.h>// Header File For The GLu32 Library
#include <gl\glaux.h>
Run Code Online (Sandbox Code Playgroud)
BYTE来自哪里?
dso*_*ano 26
我猜这是来自Windows.
一个字节(8位).
此类型在WinDef.h中声明如下:
typedef unsigned char BYTE;
小智 11
如果您正在为Windows编程C,我假设您正在使用Visual Studio进行开发.您可以右键单击任何关键字,然后选择" 转到定义" F12以查找其定义位置.
BYTE在WinDef.h中定义
typedef unsigned char BYTE;
Run Code Online (Sandbox Code Playgroud)
几乎可以肯定,从包含的众多标题之一windows.h.Windows SDK包含typedefs for BYTE,WORD和DWORD至少Windows 2.0天(我记得最早的Windows SDK).