MATLAB: Data type errors in tmwtypes.h while compiling with mex

gcclinuxmex

Using gcc / g++ 4.4.7, I get the following errors on attempting to compile SeDuMi:
mex -O -DUNIX -DmwIndex=int -DmwSize=int -DmwSignedIndex=int bwblkslv.c sdmauxFill.c sdmauxRdot.c "-lmwlapack"
In file included from /usr/local/MATLAB/R2012b/extern/include/matrix.h:294,
from /usr/local/MATLAB/R2012b/extern/include/mex.h:58,
from bwblkslv.c:44:
/usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:792: error: two or more data types in declaration specifiers
/usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:792: warning: useless type name in empty declaration
/usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:793: error: two or more data types in declaration specifiers
/usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:793: warning: useless type name in empty declaration
/usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:794: error: two or more data types in declaration specifiers
/usr/local/MATLAB/R2012b/extern/include/tmwtypes.h:794: warning: useless type name in empty declaration
mex: compile of ' "bwblkslv.c"' failed.
I'm not able to make much sense of the error, but it seems rather odd to have a built-in header fail this way.
The only system-wide change that I've made is modifying mexopts.sh to use gcc/g++-4.4 instead of the system's gcc/g++-4.6.
Anyway, I'm totally over my head here. Help much appreciated!
Edit: Spot manages to use mex just fine though, so maybe it is a bug in SeDuMi…

Best Answer

I suspect the defines -DmwIndex=int -DmwSize=int -DmwSignedIndex=int were intended for older versions of MATLAB (R2006a and earlier) that did not have these defined. But mwIndex, mwSize, and mwSignedIndex are defined for R2006b and later, including the R2012b you are using. I would suggest deleting these defines from the mex command line. E.g., try this instead:
mex -O -DUNIX bwblkslv.c sdmauxFill.c sdmauxRdot.c "-lmwlapack"