help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling .c code using mkoctfile


From: Colin Kikuchi
Subject: Re: Compiling .c code using mkoctfile
Date: Thu, 6 Dec 2018 20:04:26 -0700

Hey Carlo,

Thanks, this is very helpful! 
Sorry to keep bugging you, but as a follow-up question, I have tried compiling with mkoctfile after commneting out the header information. Now, Octave is saying that 'mwSize' is an unknown type name:

mexADIconf.c:44:14: error: unknown type name 'mwSize'
              mwSize nz, mwSize nr, mwSize nper, mwSize *nt, double *dt,

My understanding is that mwSize is a type name defining the size of arrays. Is there something I have to add to get Octave to recognize this, or should I call it something else?

Thanks again!

-Colin

On Thu, Dec 6, 2018 at 10:24 AM Carlo De Falco <address@hidden> wrote:


> On 6 Dec 2018, at 17:57, Colin Kikuchi <address@hidden> wrote:
>
> Hey Carlo,
> Thank you for your response! I tried compiling to an mex file based on the link you sent, using "mkoctfile --mex mexADIconf.c", but got the same error. I am attaching an example of the code I am trying to compile (there are several other programs like this one) in hopes that you or someone else might be able to give me a tip about compiling into an octfile. Sorry, I am a bit inexperienced with Octave so would really appreciate any suggestions you might have!
>
> Thanks again!
>
> -Colin

Compiling your code I see the following :

$ mkoctfile -mex mexADIconf.c
mexADIconf.c:37:10: warning: non-portable path to file '<Matrix.h>'; specified path differs in case from file name on disk
      [-Wnonportable-include-path]
#include <matrix.h>
         ^~~~~~~~~~
         <Matrix.h>
In file included from mexADIconf.c:37:
In file included from /opt/octave/4.4.0/include/octave-4.4.0/octave/matrix.h:31:
In file included from /opt/octave/4.4.0/include/octave-4.4.0/octave/mx-base.h:30:
In file included from /opt/octave/4.4.0/include/octave-4.4.0/octave/MatrixType.h:29:
In file included from /opt/octave/4.4.0/include/octave-4.4.0/octave/MSparse.h:29:
In file included from /opt/octave/4.4.0/include/octave-4.4.0/octave/Array-util.h:28:
/opt/octave/4.4.0/include/octave-4.4.0/octave/Array.h:30:10: fatal error: 'cassert' file not found
#include <cassert>
         ^~~~~~~~~
1 warning and 1 error generated.


The first message is just a warning as on macos files are not case sensitive the same would be an error on Linux.
The second one is because you are including directly matrix.h from liboctave which includes cassert which is C++.

Just comment out the unnecessary includes and all should work:

/* header */
#include <mex.h>
//#include <matrix.h>
//#include <stdlib.h>
//#include <math.h>


HTH,
c.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]