# Compiling .c code using mkoctfile

6 messages
Open this post in threaded view
|

## Compiling .c code using mkoctfile

 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 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?Thank you!-Colin
Open this post in threaded view
|

## Re: Compiling .c code using mkoctfile

 Hi, > On 6 Dec 2018, at 00:27, Colin Kikuchi <[hidden email]> 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 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.
Open this post in threaded view
|

## Re: Compiling .c code using mkoctfile

Open this post in threaded view
|