Octave and SWIG. mkoctfile complains: unrecognized argument
Question
I am in the process of writing a lightweight Octave binding to Quantlib, using SWIG and mkoctfile. I am following the documentation found on the SWIG and Octave homepage.
From the SWIG documentation:
27.2.1 Compiling a dynamic module
Octave modules are DLLs/shared objects having the ".oct" suffix. Building an oct file is usually done with the mkoctfile command (either within Octave itself, or from the shell). For example,
$ swig -octave -c++ example.i -o example_wrap.cxx $ mkoctfile example_wrap.cxx example.c
where example.c is the file containing the gcd() implementation.
These are the files I have so far:
- my SWIG interface file quantlib-octave.i
- my function implementations quantlib-octave.cpp
- a glue wrapper file generated using SWIG: quantlib-octave_wrap.cxx
This is the CLI output when I invoked mkoctfile:
root@yourbox:~/src/quantlib-octave$ mkoctfile quantlib-octave_wrap.cxx quantlib-octave.cpp mkoctfile: unrecognized argument quantlib-octave_wrap.cxx
The help information displayed when I type mkoctfile -h
is not very useful.
Does anyone know why mkoctfile is complaining?
Version Info
SWIG Version 2.0.4
Compiled with g++ [x86_64-unknown-linux-gnu]
Configured options: +pcre
mkoctfile, version 3.6.0
Octave: 3.6.0
La solution
I managed to get this to work by renaming the extension of the generated file from .cxx to .cpp.
Maybe there is a better solution?