diff --git a/Source/LibJXR/image/decode/segdec.c b/Source/LibJXR/image/decode/segdec.c
--- a/Source/LibJXR/image/decode/segdec.c
+++ b/Source/LibJXR/image/decode/segdec.c
@@ -62,8 +62,14 @@ static U32 _FORCEINLINE _load4(void* pv)
     v = ((U16 *) pv)[0];
     v |= ((U32)((U16 *) pv)[1]) << 16;
     return _byteswap_ulong(v);
-#else // _M_IA64
+#elif defined(_MSC_VER)
     return _byteswap_ulong(*(U32*)pv);
+#else
+    U32 Byte0 = *(U32*)pv & 0x000000FF;
+    U32 Byte1 = *(U32*)pv & 0x0000FF00;
+    U32 Byte2 = *(U32*)pv & 0x00FF0000;
+    U32 Byte3 = *(U32*)pv & 0xFF000000;
+    return (Byte0 << 24) | (Byte1 << 8) | (Byte2 >> 8) | (Byte3 >> 24);
 #endif // _M_IA64
 #endif // _BIG__ENDIAN_
 }
diff --git a/Source/LibJXR/jxrgluelib/JXRGlueJxr.c b/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
--- a/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
+++ b/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
@@ -29,6 +29,8 @@
 #include <limits.h>
 #include <JXRGlue.h>
 
+#include <stdio.h>
+#include <wchar.h>
 
 static const char szHDPhotoFormat[] = "<dc:format>image/vnd.ms-photo</dc:format>";
 const U32 IFDEntryTypeSizes[] = { 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 };
