[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 06:18:05 +0000 |
Hi,
> On 6 Dec 2018, at 00:27, Colin Kikuchi <address@hidden> wrote:
>
> Hello,
> I am trying to use mkoctfile to compile some .c source code. When I try to do
> this, this message appears:
>
> C:\Octave\OCTAVE~1.1\include\octave-4.4.1\octave/Array.h:30:10: fatal error:
> cassert: No such file or directory
> #include <cassert>
This #include statement is meant for C++ not C.
> I read some of the Octave support groups and it seems that this is because I
> can't #include Octave headers in the source code. It isn't clear to me if
> there is a good work around. Has anyone encountered this and worked out a fix
> for how to easily compile .c code using mkoctfile?
Octave libraries are in C++, not C, so you cannot include their headers in your
C code and compile with a C compiler.
Depending on what you want to do, you can either
* compile your C code with a C++ compiler (the easiest way to do so is to
rename it to .cc instead of .c)
* access Octave libraries via the mex interface (which is a Matlab compatible C
API) as explained here :
https://octave.org/doc/interpreter/Mex_002dFiles.html#Mex_002dFiles
> Thank you!
>
> -Colin
Hope this helps, if you need more in-depth help you should provide more info,
or share the .c code you are trying to compile.
c.