'uint32_t' identifier not found error

I am porting code from Linux C to Visual C ++ for Windows.

Visual C ++ does not know #include <stdint.h> , so I commented on this.

Later I found a lot of these errors 'uint32_t': identifier not found . How can this be solved?

+62
c ++ c visual-c ++
Mar 02 2018-11-11T00:
source share
7 answers

This type is defined in the C <stdint.h> header, which is part of the C ++ 11 standard, but not standard in C ++ 03. According to the Wikipedia page in the header , it does not ship with Visual Studio until VS2010.

In the meantime, you could probably fake your own version of the header by adding a typedef to display typical Microsoft user types the types expected by C. For example:

 typedef __int32 int32_t; typedef unsigned __int32 uint32_t; /* ... etc. ... */ 

Hope this helps!

+75
Mar 02 2018-11-11T00:
source share

You can #include <cstdint> . This is part of the C ++ standard since 2011.

+55
Aug 29 '13 at 6:02
source share

Boost Config offers these typedefs for toolboxes that do not provide them natively. The documentation for this particular function is given here: Standard Integer Types

+7
Mar 02 '11 at 3:12
source share

There is an implementation available on the msinttypes page - "This project fills the lack of stdint.h and inttypes.h in Microsoft Visual Studio."

I have no experience with this implementation, but I saw how he recommended others in SO.

+3
Mar 02 '11 at 3:27
source share

On Windows, I usually use window types. To use it, you must enable <Windows.h> .

In this case, uint32_t is UINT32 or just UINT.

Definitions of all types: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751%28v=vs.85%29.aspx

+2
Jun 17 '13 at 8:20
source share

I have the same error and I fixed it by including in the file the following

 #include <stdint.h> 

at the beginning of the file.

+2
Aug 31 '15 at 13:59 on
source share

I had to run the project in VS2010, and I could not make any changes to the code. My solution was to install vS2013, and in VS2010 - VC ++ Directories-> IncludeDirectories for program files (x86) \ Microsoft Visual Studio 12.0 \ VC \ include. Then my project was drafted without any problems.

0
Oct 11 '16 at 20:41
source share



All Articles