Data type errors in tmwtypes.h while compiling with mex
Show older comments
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...
Accepted Answer
More Answers (1)
This code can be added the C/C++ files to support the new types for old Matlab versions:
// Assume 32 bit addressing for Matlab 6.5:
// See MEX option "compatibleArrayDims" for MEX in Matlab >= 7.7.
#ifndef MWSIZE_MAX
#define mwSize int32_T // Defined in tmwtypes.h
#define mwIndex int32_T
#define mwSignedIndex int32_T
#define MWSIZE_MAX MAX_int32_T
#endif
Categories
Find more on MATLAB Compiler SDK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!