Question

I'm trying to compile an open source project I downloaded which was apparently written in VC++ 7.1.

After a lot of trouble, being a novice at C++, I managed to download and fix includes for STLPort that the project uses. However, I get something like 15,000 errors complaining that certain types are not defined. A few of them are:

u_int32_t
int64_t
u_int16_t
u_int8_t

After a bit of Googling, I figured out they are added in C99. Other developers before me have managed to compile it using VC. I'm using VC 10 though.

The project has been dead for a few years, so I cannot contact the author.

Was it helpful?

Solution

The Visual C++ compiler does not support most C99 features.

If you want to use the standard fixed-width integer types, you need to make sure you include <cstdint> and qualify them with std:: or include <stdint.h>.

The standard fixed-width unsigned type names are uint32_t, uint16_t, and uint8_t (that is, there is no _ between the u and int). You can, of course, typedef your own types if you want to (while you should use the standard typedefs for new code, you may need to typedef your own to interoperate with legacy code).

OTHER TIPS

It's pretty easy to define these types for yourself in Visual Studio, since they offer __int(bitsize) functionality.

typedef __int64 int64_t;
typedef unsigned __int32 u_int32_t;
typedef unsigned __int16 u_int16_t;
typedef unsigned __int8 u_int8_t;

You need to install a compatible C99 compiler and libraries, and the point the VC++10 environment at those.

However I suspect the easier way to find the build/make files and use those.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top