help-octave
[Top][All Lists]
Advanced

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

How to call Octave/Matlab script from C++ in Ubuntu?


From: kaatish
Subject: How to call Octave/Matlab script from C++ in Ubuntu?
Date: Wed, 9 Apr 2014 19:36:37 -0700 (PDT)

Hi,
I have a bunch of related Octave/Matlab files out of which one of them
contains a function that I need to call and use that result in a C++ program
that I am writing on Ubuntu. I have Octave installed on this system so I'll
be using Octave specific solutions to this problem.

I have installed the octave header file packages. I seem to get an error
when writing this simple code.

    int main(int argc, const char *argv[])
    {
      octave_main(argc, (char**)argv, true);
      ColumnVector sz(2);
      sz(0) = 10; 
      sz(1) = 12; 
      octave_value_list functionArguments = octave_value(sz);
      do_octave_atexit();
      return 0;
    }

The compilation command is

    g++ -L /usr/lib/octave/3.2.4 -I /usr/lib/octave-3.2.4 -loctinterp
-loctave -loctave salone.cpp

The error that I get is

    /usr/bin/ld: /usr/lib/octave-3.2.4/liboctinterp.so: undefined reference
to symbol 'Array<std::basic_string&lt;char, std::char_traits&lt;char>,
std::allocator<char> > >::~Array()'
    /usr/bin/ld: note: 'Array<std::basic_string&lt;char,
std::char_traits&lt;char>, std::allocator<char> > >::~Array()' is defined in
DSO /usr/lib/octave-3.2.4/liboctave.so so try adding it to the linker
command line
    /usr/lib/octave-3.2.4/liboctave.so: could not read symbols: Invalid
operation
    collect2: ld returned 1 exit status

Could someone please explain how to solve this? I have seen some example but
they are about making a standalone problem, which does not seem to be what I
am looking for. I just have a complicated Octave script which I want to use
with a C++ program.

So, apart from solving this error, how do I do that? I could not find any
documentation which was clear enough to help me do so.

Thanks.



--
View this message in context: 
http://octave.1599824.n4.nabble.com/How-to-call-Octave-Matlab-script-from-C-in-Ubuntu-tp4663554.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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