哪个C / C ++头文件定义了BYTE数据类型?

问题描述 投票:23回答:3

我正在使用此声明移植标头:

 struct tMaterialInfo {     
    char strName[255]; // the texture name
    char strFile [255]; // the texture
     BYTE color [3]; // the color of the object 
 };

标题包含以下内容:

#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>

BYTE来自哪里?

c++ c windows
3个回答
26
投票

我猜这是来自Windows

一个字节(8位)。

此类型在WinDef.h中声明如下:

typedef unsigned char BYTE;


11
投票

如果您正在为Windows编程C,我假设您正在使用Visual Studio进行开发。您可以右键单击任何关键字,然后选择转到定义F12以查找其定义位置。

BYTE在WinDef.h中定义

typedef unsigned char       BYTE;

5
投票

几乎可以肯定来自windows.h的众多标题之一。 Windows SDK包含了typedefBYTEWORDDWORDs,因为至少Windows 2.0天(我记得最早的Windows SDK)。

© www.soinside.com 2019 - 2024. All rights reserved.