mex.h does not include config.h

John W. Eaton jwe at octave.org
Mon May 25 08:52:45 CDT 2009


On 25-May-2009, Kris Thielemans wrote:

| I've copied the compilation errors I get below with a simplistic test file
| (note: I haven't checked if this mexFunction actually works, I just copied
| something from somewhere else and cut-out stuff irrelevant to this issue).
| I'm using the cygwin version of octave 3.0.3. I could get rid of these by
| #defining some stuff like HAVE_LIMITS_H etc myself, but that's obviously why
| config.h is there.
| 
| Kris
| 
| ----------- test.cc ---------------
| /*#include <config.h>*/
| #include <mex.h>
| #include <matrix.h>
| 
| 
| void mexFunction( int nlhs, mxArray *plhs[],
| int nrhs, const mxArray*prhs[] )
| 
| {
|     double in = mxGetScalar(prhs[0]);
|     double *m_num;
|     plhs[0]= mxCreateDoubleMatrix(1,1,mxREAL);    
|     m_num = mxGetPr(plhs[0]);
|     *m_num= in*2;
|     return;
| }
| 
| ---------- output of "mkoctfile test.cc" -------------------
| In file included from /usr/include/octave-3.0.3/octave/MatrixType.h:27,
|                  from /usr/include/octave-3.0.3/octave/mx-base.h:29,
|                  from /usr/include/octave-3.0.3/octave/matrix.h:31,
|                  from test.cc:3:

Octave does not provide matrix.h.  It does provide Matrix.h, but that
is not the same as the matrix.h that Matlab provides.  Are you using
one of those systems with a case-preserving but case-insensitive
filesystem?

In any case, you shouldn't need to include matrix.h to build a MEX
file with Octave (or Matlab).

jwe


More information about the Bug-octave mailing list