help-octave
[Top][All Lists]
Advanced

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

Re: error: feval: function 'pkg.m' not found


From: ola
Subject: Re: error: feval: function 'pkg.m' not found
Date: Wed, 9 Jan 2019 14:04:47 -0600 (CST)

Of course, I will be grateful for any help. :)

I have two short code variants based on 
http://octave.org/doc/interpreter/Standalone-Programs.html#Standalone-Programs
<http://octave.org/doc/interpreter/Standalone-Programs.html#Standalone-Programs>
  
I would like to use the lsqlin function from the optim package in my c++
code. Unfortunately, I have a problem with importing this package into
octave at c++ code level. I have installed the main octave and optim
packages. My system is Ubuntu 18.04. The 'pkg load optim' command works in
the graphical octave interface, but I need to do it directly in my c++ code.

1) it compiles but returns an error related to memory dump: my_code.cc
#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/interpreter.h>

int main(const int argc, const char* argv[]) {
  feval("pkg", ovl("load", "optim"), 0);                                        
                               
//HERE I get memory dump
//  octave_value_list OUT = Ffeval("lsqlin", ovl(C, d, A, b, Aeq, beq, lb,
ub), 5);          //I need to use lsqlin function 
}

2) it shall not be compiled: my_code.cc
#include <iostream>
#include <octave/oct.h>
#include <octave/builtin-defun-decls.h>

int main(const int argc, const char* argv[]) {
  octave_value_list out = Fcos(ovl(-1), 1);     //works
  std::cerr<<out(0).double_value()<<"\n";
  Ffeval("pkg", ovl("load", "optim"), 0);          //error: invalid
initialization of reference of type ‘const octave_value_list&’ from
expression of type ‘const char [4]’
//  octave_value_list OUT = Ffeval("lsqlin", ovl(C, d, A, b, Aeq, beq, lb,
ub), 5);             
}

Thank You!



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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