C++ 为什么 Microsoft Visual Studio 找不到 <stdint.h>?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12970293/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why Microsoft Visual Studio cannot find <stdint.h>?
提问by Narek
Possible Duplicate:
Visual Studio support for new C / C++ standards?
See the text below from wiki:
请参阅以下来自wiki的文本:
The C99 standard includes definitions of several new integer types to enhance the portability of programs[2]. The already available basic integer types were deemed insufficient, because their actual sizes are implementation defined and may vary across different systems. The new types are especially useful in embedded environments where hardware supports usually only several types and that support varies from system to system. All new types are defined in inttypes.h header (cinttypes header in C++) and also are available at stdint.h header (cstdint header in C++). The types can be grouped into the following categories:
C99 标准包括几个新的整数类型的定义,以增强程序的可移植性[2]。已经可用的基本整数类型被认为是不够的,因为它们的实际大小是由实现定义的,并且可能因不同的系统而异。新类型在硬件通常只支持几种类型并且支持因系统而异的嵌入式环境中特别有用。所有新类型都在 inttypes.h 头文件(C++ 中的 cinttypes 头文件)中定义,也可在 stdint.h 头文件(C++ 中的 cstdint 头文件)中使用。这些类型可以分为以下几类:
My visual studio can not find any of this files:
我的视觉工作室找不到任何这些文件:
<cstdint>
<cinttypes>
<stdint.h>
<inttypes.h>
<cstdint>
<cinttypes>
<stdint.h>
<inttypes.h>
Why?
为什么?
回答by Jesse Good
EDIT
编辑
Note that starting from Visual Studio 2013, C99 library supporthas been added to Visual Studio.
请注意,从 Visual Studio 2013 开始,C99 库支持已添加到 Visual Studio。
The answer below is my old answer before Visual Studio 2013 added support:
下面的答案是我在 Visual Studio 2013 添加支持之前的旧答案:
MSVC has very poor support for the C language, they do not support anything past C90. Herb Sutter has already publicly stated this in his blog.
MSVC 对 C 语言的支持很差,它们不支持 C90 以后的任何东西。Herb Sutter 已经在他的博客中公开说明了这一点。
<cstdint>
is supported from MSVC2012.
<cstdint>
MSVC2012支持。
There is a msinttypesproject that fills the absence of stdint.h and inttypes.h in Microsoft Visual Studio.
有一个msinttypes项目填补了 Microsoft Visual Studio 中 stdint.h 和 inttypes.h 的缺失。
Boost also provides boost/cstdint.hppif you do not have it.
如果您没有,Boost 还提供boost/cstdint.hpp。