在 VS2008 下编译c++程序,发现找不到 stdint.h, 最后证实原因如下红字,解决方案是改用符合C99标准的编译器(如VS2010),或自定义头文件:
#ifdef _MSC_VER
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
Visual Studio 2003 - 2008 (Visual C++ 7.1 - 9) don't claim to be C99 compatible
另注:在VS2010下,stdint.h 的位置在 C:\Program Files\Microsoft Visual Studio 10.0\VC\include