help-octave
[Top][All Lists]
Advanced

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

using octave from a C++ program


From: Jonathan Hudson
Subject: using octave from a C++ program
Date: Wed, 22 Oct 2003 10:33:49 -0500

I'm trying to use some of octave's functions within a C++ program,
but I'm getting lots of undefined references and 
I'm not sure what I'm doing wrong.

I wrote a simple test program to get the errors:
------test.cpp---------
include "octave/oct.h"
#include "octave/parse.h"

#include <cstdio>

void eval(const char *string)
{
  int parse_status;
  eval_string(string, true, parse_status);
  printf("Parse Status (silent=true): %d\n", parse_status);
  eval_string(string, false, parse_status);
  printf("Parse Status (silent=false): %d\n", parse_status);
}

int main()
{
  eval("a = [1 2 3 4 5]");

  eval("b 1.5");

  return 0;
}
---------------------

Here's the command line I'm using:
> g++ -c test.cpp -I/usr/include/octave-2.1.40/octave/ 
> -I/usr/include/octave-2.1.40/
> g++ -o test test.o -L/usr/include/octave-2.1.40/ -loctave -lcruft -loctinterp

I get hundreds of lines of undefined references.
Here's a few of them: 
/usr/local/lib/liboctinterp.a(pr-output.o)(.text+0x38fe): In function
`octave_print_internal(std::basic_ostream<char, std::char_traits<char>
>&, charMatrix const&, bool, int, bool)':
/usr/local/src/octave-2.1.49/src/pr-output.cc:1745: undefined reference
to `octave_interrupt_state'
/usr/local/lib/liboctinterp.a(pr-output.o)(.text+0x391c):/usr/local/src/octave-2.1.49/src/pr-output.cc:1747:
undefined reference to `charMatrix::row_as_string(int, bool, bool) const'
/usr/local/lib/liboctinterp.a(pr-output.o)(.text+0x3a53):/usr/local/src/octave-2.1.49/src/pr-output.cc:1771:
undefined reference to `octave_interrupt_state'
/usr/local/lib/liboctinterp.a(pr-output.o)(.text+0x3a5c):/usr/local/src/octave-2.1.49/src/pr-output.cc:1771:
undefined reference to `octave_throw_interrupt_exception'
/usr/local/lib/liboctinterp.a(pr-output.o)(.text+0x4c6e): In function
`output_max_field_width':
/usr/local/src/octave-2.1.49/src/pr-output.cc:2132: undefined reference
to `NINT(double)'
/usr/local/lib/liboctinterp.a(pr-output.o)(.text+0x4cd1): In function
`output_max_field_width':
/usr/include/c++/3.2.2/bits/basic_string.h:187: undefined reference to
`octave_is_NaN_or_NA(double)'
/usr/local/lib/liboctinterp.a(pr-output.o)(.text+0x4d7e): In function
`output_precision':
/usr/local/src/octave-2.1.49/src/pr-output.cc:2150: undefined reference
to `NINT(double)'
/usr/local/lib/liboctinterp.a(pr-output.o)(.text+0x4de1): In function
`output_precision':
/usr/include/c++/3.2.2/bits/basic_string.h:187: undefined reference to
`octave_is_NaN_or_NA(double)'

I'm using octave 2.1.40 from Red Hat 9 on a PIII.

Where am I going wrong?

Thanks for any help,
Jonathan

-- 
http://www.fastmail.fm - Sent 0.000002 seconds ago



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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