Yes, stdint.h and inttypes.h are missing from Microsoft Visual Studio. As a result, anyone who’s written cross-platform C\C++ code for Windows has probably seen this error:
error C2146: syntax error : missing ';' before identifier 'foo'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
The fact is that Visual Studio doesn’t implement C99… it implements C89 (for compatibility reasons). So, you don’t have access to familiar types like:
int8_t, int16_t, int32_t, int64_tuint8_t, uint16_t, uint32_t, uint64_tINT8_MIN,INT8_MAX, etc- The
fprintfmacrosPRId32,PRIu32, etc strtoimax(), etc
Fortunately, Alexander Chemeris has written msinttypes: an implementation of stdint.h and inttypes.h for Microsoft Visual Studio. It is licensed under the BSD license, so the headers are actually usable commercially (no viral GPL). This following quote probably goes without saying (emphasis mine):
Note though, that just adding these headers does not make Visual Studio compiler fully C99 compliant.
This project has saved me a bunch of unwanted coding. Thanks Alex!


Visual Studio 2010 has stdint.h in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
Reply