Build fails on windows with VS 2015
Opened this issue · 0 comments
Building this library via the NodeJS wrapper module node-sfnt2woff-zopfli configured for VS 2015 Update 3 gives an error regarding a redefinition of int8_t
and different basic types.
Visual Studio defines int8_t
and other inttypes since VS 2010, where they're available in stdint.h
. Compilation fails because the compiler is being pedantic about a type mismatch with those standard headers.
You should either expand the #ifdef _MSC_VER
check to handle compatible versions, or you should ensure that the redefinition is type-compatible. Adding an explicit signed
to the redefinitions of int8_t
; int16_t
and int32_t
might fix this, but the better method is probably to use what's there.
I.e. with MS compilers, import Microsoft's standard implementation if it is known to exist; otherwise rely on the older non-standard definitions for __int8
and similar. E.g.
#ifdef _MSC_VER
#if _MSC_VER >= 1600
#include <stdint>
#else
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#endif
#endif