[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiling .c code using mkoctfile
From: |
Carlo De Falco |
Subject: |
Re: Compiling .c code using mkoctfile |
Date: |
Thu, 6 Dec 2018 17:24:46 +0000 |
> 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.