Data type errors in tmwtypes.h while compiling with mex

10 visualizaciones (últimos 30 días)
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...

Respuesta aceptada

James Tursa
James Tursa el 22 de En. de 2013
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"
  2 comentarios
Edward
Edward el 22 de En. de 2013
Editada: Edward el 22 de En. de 2013
Thanks! For future reference, doing as you reccomended solved the initial problem, and pointed out that the larger problem was the install script not recognizing the MATLAB version (which caused a linking problem later on).
James Tursa
James Tursa el 22 de En. de 2013
Another item to be aware of for automated scripts using BLAS and LAPACK functions is that up through R2007a the functions for both of these libraries were physically combined into the single LAPACK library that ships with MATLAB. Starting with R2007b the BLAS and LAPACK libraries are shipped as two separate library files.

Iniciar sesión para comentar.

Más respuestas (1)

Jan
Jan el 22 de En. de 2013
Editada: Jan el 22 de En. de 2013
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

Categorías

Más información sobre MATLAB Compiler SDK en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by