help-octave
[Top][All Lists]
Advanced

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

mkoctfile and C


From: Laurent Hoeltgen
Subject: mkoctfile and C
Date: Mon, 21 Feb 2011 10:46:00 +0100

Hi,

I was wondering if there is some magic behind compiling C code with
mkoctfile. On the octave webpages, there's this short example written in
C++ which compiles fine for me. However, I can't get anything to run
once it's in plain C.

The following code

#include <octave/oct.h>

DEFUN_DLD (foo,args,nargout,"foo")
{
    return octave_value_list ();
}

(which in my opinion should simply do nothing) fails to compile. I get
the following message:

octave:3> mkoctfile foo.c 
In file included
from /usr/local/include/octave-3.4.0/octave/../octave/mx-base.h:28,

from /usr/local/include/octave-3.4.0/octave/../octave/Matrix.h:30,

from /usr/local/include/octave-3.4.0/octave/../octave/oct.h:33,
                 from foo.c:1:
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:27: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Matrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:28: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ComplexMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:29: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘FloatMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:30: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘FloatComplexMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:31: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘SparseMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:32: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘SparseComplexMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:36: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘MatrixType’
In file included
from /usr/local/include/octave-3.4.0/octave/../octave/boolMatrix.h:27,

from /usr/local/include/octave-3.4.0/octave/../octave/mx-base.h:32,

from /usr/local/include/octave-3.4.0/octave/../octave/Matrix.h:30,

from /usr/local/include/octave-3.4.0/octave/../octave/oct.h:33,
                 from foo.c:1:
/usr/local/include/octave-3.4.0/octave/../octave/Array.h:29: fatal
error: cassert: No such file or directory
compilation terminated.
octave:4> mkoctfile foo.c 
In file included
from /usr/local/include/octave-3.4.0/octave/../octave/mx-base.h:28,

from /usr/local/include/octave-3.4.0/octave/../octave/Matrix.h:30,

from /usr/local/include/octave-3.4.0/octave/../octave/oct.h:33,
                 from foo.c:1:
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:27: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Matrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:28: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ComplexMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:29: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘FloatMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:30: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘FloatComplexMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:31: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘SparseMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:32: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘SparseComplexMatrix’
/usr/local/include/octave-3.4.0/octave/../octave/MatrixType.h:36: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘MatrixType’
In file included
from /usr/local/include/octave-3.4.0/octave/../octave/boolMatrix.h:27,

from /usr/local/include/octave-3.4.0/octave/../octave/mx-base.h:32,

from /usr/local/include/octave-3.4.0/octave/../octave/Matrix.h:30,

from /usr/local/include/octave-3.4.0/octave/../octave/oct.h:33,
                 from foo.c:1:
/usr/local/include/octave-3.4.0/octave/../octave/Array.h:29: fatal
error: cassert: No such file or directory
compilation terminated.

Can anybody tell me what I'm doing wrong here? I'm using octave 3.4 on
Ubuntu 10.10.

Regards,
Laurent

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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