mex.h does not include config.h

Kris Thielemans kris.thielemans at imperial.ac.uk
Mon May 25 13:33:03 CDT 2009


> From: John W. Eaton [mailto:jwe at octave.org] 
> Sent: 25 May 2009 14:53
> To: Kris Thielemans
> Cc: 'Kris Thielemans'; bug at octave.org
> Subject: RE: mex.h does not include config.h
> 
> 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. 

Ok, as matlab does seem to have matrix.h, this seems an incompatibility, but
I can live with that.

> Are you using
> one of those systems with a case-preserving but case-insensitive
> filesystem?
>

Yes, this is on Windows (using CYGWIN).

Error messages are the same (of course) when including Matrix.h. So, this
might then be a bug in Matrix.h?
 
> In any case, you shouldn't need to include matrix.h to build a MEX
> file with Octave (or Matlab).

That seems correct. Error messages disappear when I don't include matrix.h,
while Matlab's mex still works.

So, you've my problem once again. Thanks!

Kris



More information about the Bug-octave mailing list