diff --git a/mex/sources/build.m b/mex/sources/build.m
index ea016cc93966068bd49e4535415537d6b9d35f44..f1c0fb1664e3dddadad98ae9217797a099660ff8 100644
--- a/mex/sources/build.m
+++ b/mex/sources/build.m
@@ -25,6 +25,7 @@ if strcmpi('GLNX86', computer) || strcmpi('GLNXA64', computer) ...
     if VERSION <= 7.4
         BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
         COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DNO_BLAS_H' ];
+        COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED -DNO_BLAS_H' ];
     else
         BLAS_PATH = '-lmwblas';
     end
diff --git a/mex/sources/gensylv/cc/SylvParams.cpp b/mex/sources/gensylv/cc/SylvParams.cpp
index 4b8e64c2797068b5cb9f553dfd729ad10302bb1b..7913222429a998495a1772b3510d28c84a65cb48 100644
--- a/mex/sources/gensylv/cc/SylvParams.cpp
+++ b/mex/sources/gensylv/cc/SylvParams.cpp
@@ -4,6 +4,9 @@
 
 #include "SylvParams.h"
 
+#ifdef MWTYPES_NOT_DEFINED
+typedef int mwSize;
+#endif
 
 void SylvParams::print(const char* prefix) const
 {
diff --git a/mex/sources/gensylv/matlab/gensylv.cpp b/mex/sources/gensylv/matlab/gensylv.cpp
index 6dc66e1e440f8a2b48ae510dc7c3b9f8bc754c12..55eaca9393890396285329f830fc870ac95f2ba5 100644
--- a/mex/sources/gensylv/matlab/gensylv.cpp
+++ b/mex/sources/gensylv/matlab/gensylv.cpp
@@ -6,8 +6,7 @@
 #include "mex.h"
 
 #ifdef MWTYPES_NOT_DEFINED
-typedef unsigned int mwIndex;
-typedef unsigned int mwSize;
+typedef int mwSize;
 #endif
 
 #include "GeneralSylvester.h"