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 09:57:44 -0700

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

On Wed, Dec 5, 2018 at 11:18 PM Carlo De Falco <address@hidden> wrote:
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.

Attachment: mexADIconf.c
Description: Text document


reply via email to

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