Help with running embedded standalone program v 6.4.0
ashwin damle <[email protected]> Thu, 6 Jan 2022 09:47:57 +0530
| Newsgroups | gmane.comp.gnu.octave.general |
|---|---|
| Message-ID | <CAC-NLwytsdoFxmUq4ZSPxRV5FRM7C7iYJfa=rcZ=1fpQm22q2Q@mail.gmail.com> |
Hello, I am trying to run the embedded program at Standalone Programs (GNU Octave (version 6.4.0)) <https://octave.org/doc/v6.4.0/Standalone-Programs.html> - attached. When I execute the program using .exe created using mkoctfile --link-stand-alone embedded.cc -o embedded.exe I get the following error. My computer is *Windows 10*, Gnu Octave v6.4.0. This was working in the previous version v 6.2.0. Could you please guide. [image: image.png] [image: image.png] -- Ashwin Damle ---------- We are transitioning to a web based forum for community help discussions at https://octave.discourse.group/c/help
image.png
(image/png, 11 KB) - not displayed
image.png
(image/png, 11.1 KB) - not displayed
embedded.cc
(text/plain, 2.2 KB)
#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/interpreter.h>
int
main (void)
{
// Create interpreter.
octave::interpreter interpreter;
try
{
// Inhibit reading history file by calling
//
// interpreter.initialize_history (false);
// Set custom load path here if you wish by calling
//
// interpreter.initialize_load_path (false);
// Perform final initialization of interpreter, including
// executing commands from startup files by calling
//
// interpreter.initialize ();
//
// if (! interpreter.initialized ())
// {
// std::cerr << "Octave interpreter initialization failed!"
// << std::endl;
// exit (status);
// }
//
// You may skip this step if you don't need to do anything
// between reading the startup files and telling the interpreter
// that you are ready to execute commands.
// Tell the interpreter that we're ready to execute commands:
int status = interpreter.execute ();
if (status != 0)
{
std::cerr << "creating embedded Octave interpreter failed!"
<< std::endl;
return status;
}
octave_idx_type n = 2;
octave_value_list in;
for (octave_idx_type i = 0; i < n; i++)
in(i) = octave_value (5 * (i + 2));
octave_value_list out = octave::feval ("gcd", in, 1);
if (out.length () > 0)
std::cout << "GCD of ["
<< in(0).int_value ()
<< ", "
<< in(1).int_value ()
<< "] is " << out(0).int_value ()
<< std::endl;
else
std::cout << "invalid\n";
}
catch (const octave::exit_exception& ex)
{
std::cerr << "Octave interpreter exited with status = "
<< ex.exit_status () << std::endl;
}
catch (const octave::execution_exception&)
{
std::cerr << "error encountered in Octave evaluator!" << std::endl;
}
return 0;
}