The difference is that it is inside the namespace, while the other is not. Otherwise, they must be the same. The first should be a C version, and the second a C ++ version. Before C ++ 11, it was pointed out that including prefix versions instead of the standard version of the C library includes all C definitions inside the standard namespace. In C ++ 11, this restriction has been relaxed, as it is not always possible.
Perhaps your compiler implicitly defines this type. In any case, you must enable cstdint to make the version in the std available (and possibly the one contained in the global namespace). Enabling stdint.h should only make an unqualified version available.
An earlier version of Visual Studio comes without this header, so this is inevitable.
Because of all this frenzy, most people will give up third-party implementations like boost/cstdint.hpp .
Edit: They are the same and serve the same purpose. Typically: if you want to use the version in the std , enable cstdint . If you want to use this in the global namespace, include stdint.h . For C ++, it is recommended to use one in the std . As a rule of thumb: always include what you use, and do not rely on other headers, including things for you.
pmr
source share