Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/160.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 哪个C/C++;头文件定义字节数据类型?_C++_C_Windows - Fatal编程技术网

C++ 哪个C/C++;头文件定义字节数据类型?

C++ 哪个C/C++;头文件定义字节数据类型?,c++,c,windows,C++,C,Windows,我正在移植一个带有以下声明的标题: 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> #incl

我正在移植一个带有以下声明的标题:

 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>
#包括
#包括
#包括
#包括
#包括
#包括
#包含//OpenGL32库的头文件
#包含//GLu32库的头文件
#包括
那个字节来自哪里

我猜它是从

一个字节(8位)

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

typedef无符号字符字节


几乎可以肯定的是,从
windows.h
中包含的众多标题之一。Windows SDK至少从Windows 2.0开始就包含了
typedef
s for
BYTE
WORD
DWORD
(我记得最早的Windows SDK)。

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

字节在WinDef.h中定义

typedef unsigned char       BYTE;

+为了清楚地说明问题,以及提供足够的上下文来提供有用的答案,我们应该补充一点,不应该使用它。所有的大写整数/字符串类型都是无用的代码修饰,只会使代码不必要地绑定到Windows。只需使用相应的标准类型,如
unsigned char
uint8_t
(如果后者存在,则必须相同)。stdint直到2010年才添加到Visual Studio。如果您使用的是WINAPI函数,则应使用Windows数据类型。